Commit 64ab43445494

Vincent Demeester <vincent@sbr.pm>
2026-06-08 23:18:15
feat(emacs): add org-todo-subtree command
Added vde/org-todo-subtree to set TODO state across the current subtree, defaulting to active TODO entries and supporting a prefix argument to force all entries regardless of state.
1 parent c03d4bf
Changed files (1)
dots
config
emacs
dots/config/emacs/init.el
@@ -1969,6 +1969,17 @@ Works with any org link type. Creates a new tab, then opens the link."
       (dolist (tag tags)
         (org-toggle-tag (substring tag 1) (if (string-prefix-p "+" tag) 'on 'off))))))
 
+  (defun vde/org-todo-subtree (state)
+    "Set TODO entries in the current subtree to STATE.
+By default, only changes entries with an active TODO keyword,
+skipping plain headings and already-done items.
+With prefix argument (C-u), force ALL entries to STATE regardless
+of their current state."
+    (interactive
+     (list (completing-read "State: " org-todo-keywords-1 nil t)))
+    (let ((match (if current-prefix-arg nil "/!")))
+      (org-map-entries (lambda () (org-todo state)) match 'tree)))
+
 (use-package org-appear
   :hook (org-mode . org-appear-mode))