A New Trick For Marking Up Key Sequences in Emacs

Frozenlock left a comment to an old post of mine about Marking Up Key Sequences For HTML. He said he liked the way Xah Lee and I mark up Emacs keys sequences but that he didn’t like having to write ctrl+x b to get 【Ctrl+x b】 so he wrote a little hack that allows him to enter the actual key strokes and have the appropriate markup inserted at the point.

It turns out to be pretty easy to do. If I were starting from scratch (or weren’t so lazy) I’d modify my prettify-key-sequence function to accept the actual keystrokes and output the markup. Frozenlock uses the macro method that I used before I wrote prettify-key-sequence so there isn’t quite as much control over the final output but it works well for most cases. If you want to use markedup key sequences, I’d look at Frozenlock’s method and consider integrating it into something like prettify-key-sequence.

This entry was posted in Blogging and tagged , . Bookmark the permalink.