Friday, December 18, 2009

Really cool command in Emacs

Today in Emacs I have uncovered a really cool mode: "Alt+x query-replace-regexp". This will open a small window in which you type a regexp.  Emacs will be showing matches in the currently open file as you type. After that do ^C^W^C^Q to copy the regexp and close builder. Next Ctrl-Alt-% and paste the regexp into the buffer.  Before using regexp remove enclosing double-quotes.

This is really useful. I am a Perl person and for me Emacs regexp symbols are sort-of familiar but I can never remember the right ones. With instant feedback I can reuse my perlified brain to create rather sophisticated regexps in Emacs.  Too bas that I've learned about this feature only today.

No comments: