[prog] replacement strings

Miriam English mim at miriam-english.org
Mon May 24 21:53:17 UTC 2010

Thanks John. I've always eyed emacs with a kind of longing. I know it is 
an unusually powerful editor, partly because of its intimate 
relationship with lisp.

Years ago I dabbled with it, but found the commands even more arcane 
than vi's. At about the same time I learned a smattering of lisp, 
largely because it was the golden baby of AI. People's reactions to lisp 
always seem to be either "It is incredibly beautiful" or "It is 
incredibly ugly". Unfortunately, no matter how much I tried, I found 
myself in the latter group. All those goddamn brackets.

You can use emacs without lisp (though that's like having a flying car 
and only using it to drive down the road to the corner shop), but when 
emacs' interface differs so completely from every other editor on the 
planet I find it hard to motivate myself to take on the steep learning 
curve. That is what has retarded my use of vi, and is even more true of 
emacs. And this is why there was that big move to unify interfaces all 
those years ago.

Thank you for the pointer to emacs. You've given me more good reasons to 
consider it, and I may still go for it at some point, but time doesn't 
really permit at the moment. [sigh]

Like I said to Sam, so much to learn, so little time. :/

	- Miriam

john.sturdy at ul.ie wrote:

> The regexp replacement facilities in Emacs got even more wonderful in
> Emacs 22, with a couple of new \ thingies on the replacement side:
> \# gives the number of replacements done so far (so you can number lists, etc)
> \( begins an Emacs-Lisp expression, the result of which is inserted,
> so for example to force things that look like UK-style postcode elements to
> upper-case you could replace
> \<[a-z][a-z]?[0-9][0-9]?\>
> with
> \(upcase \&)
> where \< \> mean start and end of word, and \& means the whole matched
> text.
> You can combine \# and \( too, if you want to number things but not
> counting from 0, or not counting in ones, or converting to letters,
> e.g. to count from 42 upward you can use \(+ \# 42)
> See
> http://steve-yegge.blogspot.com/2006/06/shiny-and-new-emacs-22.html
> for more examples.  (I'm glad I'm not the only person who gets excited
> about new editor facilities!)
> __John

If you don't have any failures then you're not trying hard enough.
  - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
Website: http://miriam-english.org
Blog: http://miriam_e.livejournal.com

More information about the Programming mailing list