The char-menu Package

I just updated my ELPA packages and noticed the new package char-menu. It allows you to make a (possibly tree-structured) list of characters that you might want to add to an Emacs buffer. The obvious examples are round quotes—single: ‘’ or double: “”—, em and en dashes, arrows, and, perhaps, Greek letters.

This can be done in stock Emacs with the 【Ctrl+x 8】 prefix, of course, but then you have to remember the Unicode name for the character you want. In Org mode, a lot of these things are available with standard TeX shortcuts or by setting the input method to TeX. Still, you have to remember the names or shortcuts and it's often clunky to use them. With char-menu, you hit a single shortcut key and you get a menu of the characters to insert.

The menu is Avy-based so it's familiar and easy to use. The GitHub page for char-menu shows a simple list or characters and a more complex set with multiple levels. For my initial configuration I used the complex set minus the Greek letters. Here it is:

(use-package char-menu
  :ensure t
  :bind ("H-s" . char-menu)
  :config (setq char-menu '("—" "‘’" "“”" "…" "«»" "–"
                            ("Typography" "•" "©" "†" "‡" "°" "·" "§" "№" "★")
                            ("Math"       "≈" "≡" "≠" "∞" "×" "±" "∓" "÷" "√")
                            ("Arrows"     "←" "→" "↑" "↓" "⇐" "⇒" "⇑" "⇓"))))

I'll probably modify this based on my usage but it's a good beginning.

One other feature of the package is that when you have a pair of characters, such as quotes, char-menu will put the point between them. If you have highlighted text, char-menu will wrap the text with the two characters. It's a very nice and light weight solution to adding UTF-8 characters to your Emacs buffers.

This entry was posted in General and tagged . Bookmark the permalink.