using regexp find and replace to reformat my todo list

Table of Contents

Intro

I had a series of todo entries like this

 *** TODO Rename legacy/authtoken.clj and sibling tests
https://github.com/FOO/BAR/issues/158

and wanted them to have the issue number at the end of the todo title, which helps with our git branch naming praxis. Emacs regular expression (slightly improved) anzu-query-replace-regexp1 with the following:

^\(\*.*\)
\(.*github.*\)\([0-9]+\)\s-+ → \1 #\3
\2\3

Where the linebreaks are entered literally via C-q C-j.

The end result was what I wanted:

 *** TODO Rename legacy/authtoken.clj and sibling tests #158
https://github.com/FOO/BAR/issues/158

Footnotes

1 Anzu provides live previews of what your replace will do. Two warnings: if your replace is doing a LOT in the current viewport, you might stall out; and if you replace has side effects (in emacs regexp replace you can run arbitrary elisp code), those side-effects will take place at preview-time in addition to at actual run-time https://github.com/emacsorphanage/anzu

Tory Anderson avatar
Tory Anderson
Full-time Web App Engineer, Digital Humanist, Researcher, Computer Psychologist