Re:Learn Emacs: Keyboard Macros
by calibraxis on Thursday November 10, 2011 @11:50AM
(#3220737)
The easy way I do it is to make however many copies of "test0" I want, then make a trivial throwaway macro where I move my cursor to the number I want to increment, and hit M-x rolling-increment-number-at-point. (Of course with autocomplete...)
Here's my definitions:
(defvar *rolling-counter* 0)
(defun rolling-increment-number-at-point ()
(interactive)
(incf *rolling-counter*)
(skip-chars-backward "0123456789")
(or (looking-at "[0123456789]+")
(error "No number at point"))
(replace-match (number-to-string (+ *rolling-counter*
(string-to-number (match-string 0))))))
(defun clear-rolling-history ()
(interactive)
(setf *rolling-counter* 0))
Re:Learn Emacs: Keyboard Macros
by jcsalterego on Thursday November 10, 2011 @11:12AM
(#3220567)
Ow, that hurts my brain more than usual. How would one leverage registers with text instead of incremental numbers? (I will have to RTFW later.)
http://www.emacswiki.org/emacs/KeyboardMacrosTricks
From there: