Emacs and muscle memory
2023-11-16 23:05:01.27431+01 by Dan Lyke 0 comments
So Simon Tatham @simontatham@hachyderm.io asked
In #emacs, what's the easiest way to type (say) a hundred 0s?
For a non-digit printing char, ESC 100 x is easy. But for a digit, you need to indicate what's the count and what's the literal.
Perhaps C-q, "insert this literally even if you otherwise wouldn't"? For digits 8 or 9, that works, e.g. ESC 100 C-q 9.
But C-q special-cases octal
digits! So the best I've found is to enter the octal code for the digit you want: ESC 100 C-q 060 RET. Yuck. Is there an easier way I've missed?
It's Emacs, there are a number of answers. C-u 100 C-u 0
works, the second C-u works as a delimiter. A smartass suggested C-x C-c vi RET 100 i 0 ESC, and, a couple of people suggested using
C-x z
, broken down by Choan Gálvez 🐐 @choanmusic@mstdn.social as
0 ;; self-insert-command M-9 ;; digit-argument M-9 ;; digit-argument C-x z ;; repeat
And of course there's "record a 0 macro", and other such things. But what I found interesting is that as I tried to think through a couple of strategies for this, I didn't have a direct mechanism. I had to wiggle through my fingers to remember how to do this stuff.