« Pop!Tech Live | Main | Emacs and Ruby »
My HTML Mode for Emacs
Some people have asked what HTML mode I finally settled on. I’m using a customized version of Daniel Pfeiffer’s adaptation of James Clark’s sgml-mode. Yeah, there’s lots of SGML stuff that I don’t use, but it has a set of HTML keybindings and is easy to add things to. For example, here’s my code for inserting an image from Amazon:
(define-skeleton amazon-image
"HTML image tag for an Amazon book"
"ASIN: "
'(setq input "")
"<a href=\"http://www.amazon.com/exec/obidos/ASIN/"
str
"/windleyofente-20\">
<img src=\"http://images.amazon.com/images/P/"
str
".01.MZZZZZZZ.jpg\" border=\"0\"
align=\"right\" hspace=\"5\" vspace=\"5\" /></a>"
)
You can do much more complicated things. For example, I like to build tables of image thumbnails for use in blog articles from time to time as in this example from WWW2006. I created a picture-table function that codes up these tables with relatively little fuss and they’re just the way I like them.
I think it’s fine to talk about some product being a great editor and having good support for language Blub, but I want more than that. My editor has to be customizable to exactly fit my needs. I can’t imagine a non-programmable editor being flexible enough to provide significant support for that task. If your editor isn’t programmable, you’re missing out!
Posted by windley on October 20, 2006 2:18 PM



Comment from Steve Williams at October 21, 2006 10:06 AM
Programmable, yes, and cross-platform is important, too. Emacs wasn't widely available when I switched from CP/M to PC-DOS for my personal machines back in '86, so, at my brother's suggestion, I adopted the Epsilon editor from Lugaru Software. It's sort of an Emacs clone with a c-like extension language.
For just over 20 years, I've spent most of each day in Epsilon. From PC-DOS, I soon switched to OS/2, then NT4, now XP and BSD. Epsilon was available for each platform before I needed it. Epsilon is not open-source, but it competes very well with every open-source tool I've used for accessibility and reliability, and everything except the core is implemented in the extension language and delivered in source, and thus completely malleable.
Now, most of my work is on Debian, but I can sit in Epsilon on my XP laptop and feel like I'm right in the data center, editing files over scp and editing my bash shell, connected over ssh.
Configurable, extensible tools are the only way to go.
Comment from Juri Pakaste at October 23, 2006 4:27 AM
I agree about the configurability and extensibility, etc, but with some qualifications. I've basically given up on using Emacs for the day to day grind of Java coding. It sucks to give up elisp, but the help Eclipse provides is a bigger attraction.
Still, for things other than Java, I always go back to Emacs, and I'm always wondering if Eclipse is ever going to come even near a) just the basic text editing facilities and b) the extensibility.
Comment from Ulrich Hobelmann at October 27, 2006 1:19 AM
Juri, if you think Eclipse's programmability is quite a PITA (and I do; have to work with it though), you should really give NetBeans a shot (grab the newest milestone here: http://qa.netbeans.org/q-builds/index_trunk.html ; they're quite stable; the next one will also sport a brand-new Java editor, to match up Eclipse). I find its extension/plugin system LOADS easier to use. Plus the GUI doesn't look as Windowsy/un-native on my Mac.
Comment from Reynold Denise at November 7, 2006 5:02 AM
Tnx for your work! I'v used Eclipse HTML Editor for ages, but unfortunetaly some usefull features works under Windows only. Now I can turn to Emacs
Comment from Scott Graves at December 6, 2006 5:17 PM
I build languages (so I can type less and achieve more), not editors ;)
DSLs are also more resistant to change (what if the path for images changed, or the link?).
I would solve this particular problem with XSLT or a manual transform using eg. Ruby.
If you're not writing in a programmable (programming) language, you're missing out!
Leave a comment
I encourage you to leave a comment below. Your email address will not be displayed on Technometria, but allows me to communicate with you directly. Your email address won't be displayed, but will be used to compute a MicroID for your comment.