News for hackers. Stuff that matters.
Re:Learn Emacs: Keyboard Macros by jcsalterego on Thursday November 10, 2011 @11:04AM (#3220534)
I know exactly what you mean -- but perhaps it doesn't even have to be a macro, but a more powerful search-and-replace, with changing replacements.

My lisp-fu isn't good enough to implement this today, but I would find it really easy to:

* copy `#define a 0` with C-k, M-w, C-y, RET, C-y, RET, C-y, RET, ... (so copy the line and paste N times)

* begin interactive search-and-replace, with usual keybindings (Y for replace, N for skip, . for replace and stop)

* but with additional keybinding, e.g. + for change replacement and apply

Alternatively, the replace argument in M-% would be a [somehow-delimited] list of replacements, and + or capital Y would pop off the next replacement and begin using that.

There are no comments on this comment yet.