Last week I wrote about David Andersson’s Key Chord Mode that I discovered in the latest Emacs Rocks video. I thought it was interesting and I enabled it in my Emacs by adding
(require 'key-chord) (key-chord-mode 1) (key-chord-define-global "dq" 'dq)
to my scratch buffer and evaluating it just to play around with it a little. I thought it was pretty nifty but I didn’t think I would actually use it so I didn’t add it to my init.el
file.
Yesterday, as I was writing the Automatic Lookup From Emacs post, I wanted to set the function names in the first column of the table in a constant width font. In Org mode you do that by surrounding the name with equal signs like so
=lookup-google=
But the equal sign has a special meaning in an Org-mode table and it causes an error when you try to use it to mark an entry as constant width. So I set the first couple of names by hand like this
@<code>lookup-google@</code>
where the @
tells the Org exporter to treat the following tag as an actual tag and not translate it to <
and so on. The problem is that it’s a pain to type the tags because they’re shifted and the 【@】 key is way at the top of the keyboard.
I thought about writing a quick little function to do it for me but it hardly seemed worth the effort. Then I remembered key-chord.el
, which was still enabled, so I added
(key-chord-define-global "<>" "@<>\C-b")
to the scratch buffer and evaluated it. It seems like a small thing but it really made doing the rest of the table a snap. I just typed 【Shift+<+>】 and
@<|>
where |
represents the point, was inserted into the buffer. That’s handy enough that I am going to enable chord-mode in my init.el
and add the <>
chord for those, admittedly rare, times when I need to insert some HTML tags by hand.