Skip to content

Comment on Learn Emacs: Keyboard Macrosparent

Comments

The newest emacs keybindings should help sort this out. Use <F3> to make it easy. Might as well just go C-h k <F3> to see what it does, but the function name `kmacro-start-macro-or-insert-counter' might give you a clue.

Here's what I'd do for your example, starting in an empty buffer:

abcdefghijklm C-a C-SPC C-e C-w <F3> #define SPC C-y M-b C-f C-SPC C-e C-w SPC <F3> RET <F4>

Then press F4 until you reach `m'. (You may find that the sequence ends with `m' being 12.)

(NOTE you should totally use `enum' for this; your debugger may on occasion permit you to use the names when you are entering an expression, and you'll get sensible error messages in the event of a conflict. Unlikely in this case I suppose since nobody uses variables called `i' or `j'.)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.