Created
October 8, 2024 21:02
-
-
Save davemq/aed050eade20e070ecdb7189460131d1 to your computer and use it in GitHub Desktop.
Org agenda bulk deadline scatter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; org agenda bulk action for random scatter for deadlines | |
(defun drm:org-agenda-deadline () | |
(unless (org-agenda-check-type nil 'agenda 'todo) | |
(user-error "Can't scatter tasks in \"%s\" agenda view" org-agenda-type)) | |
(let ((days (read-number "Scatter tasks across how many days: " 7))) | |
(let ((distance (1+ (random days)))) | |
;; Silently fail when try to replan a sexp entry. | |
(ignore-errors | |
(let* ((date (calendar-gregorian-from-absolute | |
(+ (org-today) distance))) | |
(time (encode-time 0 0 0 (nth 1 date) (nth 0 date) | |
(nth 2 date)))) | |
(org-agenda-deadline nil time) | |
) | |
) | |
) | |
) | |
) | |
;; I tried setting this through customize, but it didn't seem to work | |
(setq org-agenda-bulk-custom-functions | |
'((?D drm:org-agenda-deadline))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment