u/stormrider-io

Don't digitize -- or even write down -- everything

Don't digitize -- or even write down -- everything

When the hamper gets full, wash things. When the litter box stinks, clean it. And when the toilet paper runs low? Take PTO, if necessary, to fix that right away.

It runs counter to GTD (one trusted system, write everything down), but when your org-mode is choked off with routine habits, the important trees disappear into the forest. I'm making a case for the ten-minute rule, instead of the two-minute rule. You'll thank me later.

https://williamwear.substack.com/p/dont-digitize-everything?r=5l1qei&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true

u/stormrider-io — 12 hours ago
▲ 27 r/orgmode+1 crossposts

I built an org-mode weekday repeater, .+wd -- cobbled together with a sidekey until I can dig into the org-mode code more. Carries you from Friday to Monday on pressing the custom keychord.

Cartoon voice in my head: "This is a job for Retirement Guy."

The journey was honest: different day-of-week constants, a stack overflow from infinite recursion, a type mismatch because org-get-scheduled-time returns a list not an integer on older Emacs builds (so version compatibility forced the long way around).

The working code:

    (defun bw/next-weekday (time)
      "Return the next weekday after TIME, skipping sat and sun."
      (let\* ((next (time-add time 86400))
             (dow (nth 6 (decode-time next))))
        (while (or (= dow 6) (= dow 0))
          (setq next (time-add next 86400))
          (setq dow (nth 6 (decode-time next))))
        next))

    (defun bw/org-advance-weekday-repeater ()
      "Advance a .+wd scheduled heading to next weekday."
      (interactive)
      (save-excursion
        (org-back-to-heading t)
        (let\* ((end (save-excursion (outline-next-heading)     (point)))
               (has-wd (re-search-forward     "SCHEDULED:.*\\.\\+wd>" end t))
               (scheduled (when has-wd (org-get-scheduled-time (point))))
               (next-time (when scheduled (bw/next-weekday scheduled))))
          (if next-time
              (progn
                (org-back-to-heading t)
                (let ((end2 (save-excursion (outline-next-heading) (point))))
                  (re-search-forward "SCHEDULED:.*\\.\\+wd>" end2 t)
                  (replace-match (concat "SCHEDULED: "
                    (format-time-string "<%Y-%m-%d %a .+wd>" next-time))))
                (org-todo "TODO")
                (message "Rescheduled to %s"
                  (format-time-string "%A, %B %d" next-time)))
            (message "No .+wd scheduled date found.")))))

    (global-set-key (kbd "C-c w") 'bw/org-advance-weekday-repeater)

Elisp is arguably the hardest language to get right — it's obscure, version-sensitive, and the Emacs internals are unforgiving. Now I just need to figure out how to refactor this into the org-mode code. Maybe.

reddit.com
u/stormrider-io — 4 months ago