Atlas · Details
Shiny and New: Emacs 22
AI Notes
A tutorial written live at the keyboard, against alpha software (Steve
was running a month-old CVS build, and the caveats section admits it
crashed on him once or twice), and the transcripts aren't cleaned up. One
replacement comes back numbered "97)" instead of "a)" because he forgot a
type conversion, and rather than edit out the flub he leaves it in with a
"D'oh!!!!" and fixes it in the next breath. The whole piece works in that
mode: he mines /usr/share/dict/words on the fly just to
build a 26-item example list, answers the perennial FAQ about typing a
newline into the minibuffer, and detours through the ways Emacs regexps
predate and diverge from Perl's. Readers who follow along get a second
essay hiding in the back half, a section bluntly titled "How do I learn
this Emacs-Lisp doohickey, anyway?" — advice (think of Lisp nesting the
way you think of XML; picture your code as a little worker bee zipping
around the buffer) plus an annotated bookshelf running from Chassell
through SICP and The Little Schemer.
The wager underneath it all was that Emacs wasn't about to become programmable in Python or Ruby "overnight," so Elisp would stay useful "for several decades at least." That call has held up better than most things predicted about editors in 2006, even if the scenery — JSP image tags, a running Ruby on Rails envy gag, a parting shot at Reddit commenters — firmly dates the visit.
Related listings
-
2005
Effective Emacs
The earlier and more famous Emacs piece — the ten-tips canon. Effective Emacs teaches you the editor; Shiny and New is what happens when you finally upgrade it.
-
2008
Emergency Elisp
Two years later, Steve does the same thing for the Elisp language. Shiny and New is the case for what the editor can do; Emergency Elisp is the case for writing the small extension yourself.
-
2007
save-excursion
The other Emacs post from this period that fixes on one tiny feature and writes at length about why it matters. The same instinct, on a smaller subject.
From the peanut gallery
Read the rest of the thread · 15 more
-
XEmacs is great and cool and spiffy and all that. I make sure all my elisp files work under FSF and XEmacs, and I do fire up XEmacs occasionally.
I just find, and maybe it's my personal bad luck, that it crashes all the time. It's been like that since I was trying to use it back on Sun SparcStations. Every year I try using it again, on a new platform, and every year I give up because it crashes. GNU Emacs pretty much never ever crashes (by comparison).
I have various friends that have noticed the same thing, independently, so I'm fairly sure they don't have an if-stevey-crash clause in their code.
I think it comes down to your personal crash tolerance. Mine is low. Restarting Emacs is painful. I leave it running for weeks at a time, with hundreds of buffers. But if you fire up a new XEmacs session every day, then you probably don't mind if it crashes occasionally. -
I'm so glad to see you've written more about Emacs--when you switched to Blogger I thought you might turn your focus away from what I believe to be the best material on your older Drunken Blog Rants.
I'll admit I have this strange fascination with Emacs blog postings--I guess I'm always trying to find out more about what other people find useful in it. I'm actually kind of surprised I don't see more of it. When I learn something nifty and new, I get excited about it and want to share. -
Also, regarding stability and the occasional odd behaviour, I've found the emacs-snapshot package that's included with Ubuntu to be completely well-behaved; it treats me as well as Emacs 21 did.
-
Well, sort of. What you really mean is if it picked up the Python r"raw string" syntax (note the preceding 'r'). You still have to escape backslashes in triple-quoted strings. And the r-strings are a little kludgy, syntax-wise. I'd rather see a paired delimiter, e.g. /some-regexp/ (the way it's done in Perl, Ruby and JavaScript -- a substantial user base), or even better, a formal reader-macro system implemented in elisp so you can simply define your own syntactic constructs for this sort of thing.
I mention PyMacs in the article, and there's a very serious objection, which isn't entirely PyMacs's fault. The problem is that Emacs lacks a JAR-like distribution mechanism via archive files. So if you write a bunch of PyMacs code, you have to tell your users to install PyMacs, and most casual Emacs users lack the sophistication to do even that much. If Emacs introduced "EAR" (emacs archive) files, it would dramatically simplify using languages other than elisp.
Honestly, though, a few fixes to elisp would go a long way towards making it more likeable. Regexps are soooo common; it's amazing they haven't updated the regexp capabilities and made it simpler to embed them in elisp code. -
Another great use for regexp in Emacs is dired mode. I routinely use this on both Unix and Windows platforms to select and rename groups of files.
C-/ is undo? Thanks -- I've been using C-_ for 25 years!
BTW, great blog. -
Another great use for regexp in Emacs is dired mode. I routinely use this on both Unix and Windows platforms to select and rename groups of files.
C-/ is undo? Thanks -- I've been using C-_ for 25 years! -
Sorry for the insignificant detail, but I don't understand the "études" line. How doesn't it finish with [a-z]?
-
Hey there,
I'm Googling for half an hour to figure out how could I reference to a \(matched\) group outside the function. That is, I want to do a (re-search-backward "\\(fo+\\)" and somehow access what would I do in Perl with $1 (whatever matched). Any hints?
Thanks.
-Mihai -
Nevermind, I just found it: http://www.delorie.com/gnu/docs/elisp-manual-21/elisp_577.html
:D -
Damnit! The replace super powers have made me ditch emacs-20.7.1 and upgrade. 20.7.1 has been with me on win95, win2K and winXP. Installed from the same tar-ball for 6 years!
-
Could it be possible to get the super-power of replace-regexp also in EMACS 21, maybe just upgrading the replace.el file?
Thanks,
Giovanni -
Hi All:
I am new to emacs, is there a way to do the search-replace in the rectangle. Or copy from one rectangle and paste to another rectangle? Thanks
William -
SICP is online now too:
http://mitpress.mit.edu/sicp/full-text/book/book.html
Thanks for this introduction. I've been on a minimalist streak for some time using vim but I'm game for seeing the other side of the fence and this was an interesting start. -
Loved your writing style; if there were more articles like this, I'd have to say less to convince people as to why I'm using 25+ year old editing technology.
-
I got some problem with (1 + \#) in replace-regexp functions.
Maybe I missed something but (+ 1 \#) works as well
Great post!
/kritstian
man, you just compared emacs to XML.
— Christopher Parker · 2:33 PM, June 15, 2006
Kristian, it's 1+ without the space to call the function with the name 1+
not a 1 followed by a +
— Unknown · 6:32 AM, October 08, 2007