Comment on Learn Emacs: Keyboard MacrosparentComments−calibraxis14yThe 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))
Comments
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: