Emacs comes with a lot of stuff out of the box, but I was missing TextMates “Insert Entity” action that lets me search through HTML entities by name and then insert
&trade; for me. I can never remember the names of typographic quotation marks in German, for example.
Some light searching on the web brought up this very cool apprach by @emacs_gifs: copy or scrape the whole List of XML and HTML character entitites reference and then use Emacs’s built-in fuzzy list filter mechanism to pick an item from the resulting list.
The original code used 1 global variable and 2 global functions. While I do agree with the factoring of these three things, I don’t want to expose all of them in my global namespace. And I also don’t want to whip up an
.el package just to hide some implementation detail. So I put the variable and the filter function inside the local namespace of the action I’m supposed to invoke.
Modular programming for the win!
Here’s the resulting code as a Gist: https://gist.github.com/DivineDominion/73fc7a5d6dd2cf95767b1264faf1d6f1
Receive new posts via email.