Atlas · Details
Shiny and New: Emacs 22
AI Notes
Steve's hands-on tour of Emacs 22, written from a CVS snapshot before
release. The post lands on two features. The first is the headline:
full Unicode and UTF-8 support, demonstrated the most Steve way possible
by typing C-h h, opening the HELLO buffer, and pasting
Chinese, Korean, and Russian greetings straight into his HTML file —
after a decade of Emacs's homegrown multibyte gymnastics, characters
now move in and out without ceremony. That alone, he says, is worth
the upgrade. The second feature is buried so deep in the NEWS file it
almost isn't there: M-x replace-regexp can now take
arbitrary Lisp expressions inside the replacement string. Steve spends
most of the post on it — six or seven progressively fancier examples,
from on-the-fly case-changing to general string transformations he used
to write whole functions for.
Sits in the same Emacs lineage as Effective Emacs — that one on why to use the editor at all; this one on why to upgrade it.
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