padding

Easy incrementing find and replace in emacs

I start with a list with a bunch of entries like this: newsletter W02 newsletter W02 newsletter W02 newsletter W02 EDIT: New Solutions It turns out that emacs automatically initializes a variable that tracks how many interations your replacement function has made, and in lisp mode you can get to it with \#. This way, the single line necessary to number all my newsletters becomes this: W\(02\) → W\,(format "%02d" (+ 4 \#))) and, of course, you can adjust that 4 to whatever you need it to be for your starting digit.