I’ve mentioned several times that I use Xah Lee’s excellent HTML/XML Entities List page to look up the code points for UTF-8 characters that I sometimes use in my blog posts. For example, in writing about Emacs Registers I wrote that you can save the point to register ρ with 【Ctrl+x r Space ρ】. My usually way of doing this is to type 【Ctrl+x 8 Return】, lookup the code point on Lee’s page, enter it, and then press 【Return】. That’s a fairly long process but I don’t do it that often so I never really minded all that much.
Now, once again, Emacs-Fu shows us the way. I’ve long been aware of abbrev-mode
, of course, but I hadn’t investigated it or thought much about it because, in general, I find automatic abbreviations annoying. They’re always overriding what you type whether or not it’s really what you want. DJCB suggests a nice trick. He adds a 0
to the end of each abbreviation so that you aren’t likely to have it expanded unintentionally. In the unlikely event that I actually wanted rho0 in the buffer I would just type rho0 followed immediately by 【Ctrl+q】 (that is, by quoting the following space or punctuation mark).
As DJCB explains, the easiest way to set this up is to simply type 【Meta+x】 edit-abbrevs
and then add whatever abbreviations you need to either the global section or whatever mode you want them in. Save the file and turn on abbrev-mode
if it’s not already on and the substitutions happen automatically unless you quote the following character. It’s probably a good idea to take a look at user level Abbrevs in the Emacs manual too.
Update: mark → point (【ctrx+x r Space ρ】 saves the point not the mark.)