Here’s my solution to the last EmacsGolf challenge. I used the apparently little-known how-many command. I normally use how-many in Elisp to count the occurrences of some regex. Here’s an example from my old blog that leverages some code from the always useful EMACS-FU. It turns out that how-many is a command and thus callable interactively. That makes the solution straightforward.
【Meta+x】 hm 【Return】 |
Call how-many |
cb 【Meta+/】 |
cb → ✓ |
| 【Return】 | result returned in minibuffer |
That does the job in 8 keystrokes.
The excellent flx-ido mapped hm to how-many on the first try despite the fact that I hadn’t used how-many in several months (and never before interactively). I map 【Meta+/】 to hippie-expand, which takes care of expanding the abbreviation.