Skip to content

Comment on Learn Emacs: Keyboard Macrosparent

Comments

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.

AboutSource Built by g1lg1l

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