macro power: removing weekends from repeating event

Table of Contents
  • Updated: [2021-12-09 Thu] comment clarifying “macros”

Intro

img

Time to make a new daily event for the next 90 days, but it shouldn’t have weekends. Most of these steps become muscle memory after getting used to emacs macro power in orgmode files, sql dumps, dired find-and-replace, text formatting, YAML/XML/HTML/JSON/EDN tailoring, etc. It’s the speed and flexibility of this method that shines, allowing for solutions to very specific problems, or just nice custom orgmode agenda entries in this case.

Easy Steps

  1. Make the initial entry, including TODO, effort estimates, and deadline/schedule/timestamp.

  2. Orgmode, org-clone-subtree-with-time-shift (C-c C-x c) so it allows note-taking for specific entries, and is granular so I can change individual instances easily

  3. I don’t want weekends, make a regexp search isearch-forward-regexp (C-M-s) that finds included Sat or Sun entries S[au]

  4. Start recording macro f3

  5. repeat search to next result C-M-s C-M-s

  6. Go to the heading of the thing I found, using C-c C-p (org-previous-visible-heading)

  7. Collapse heading and cut that one entry

  8. End macro recording then repeat until done (f4 end recording, C-99 <f4> to repeat it 99 times or until bell rings)

Comments, Resources

Improvements to this workflow are welcome. I might make this into a function if I didn’t find it a fun exercise to do it manually to keep my macro-skills sharp.

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