;; this should be run with M-x ;; all selected bulk entries should have same todo keywords (defun my/bulk-todo-with-note () "For each marked entry in the Org agenda, set the TODO state with a shared note, and insert the same user-provided note for all items." (interactive) (unless org-agenda-bulk-marked-entries (user-error "No entries are marked in the agenda")) (let* ((buffer-todo-keywords (with-current-buffer (marker-buffer (car org-agenda-bulk-marked-entries)) org-todo-keywords-1)) (chosen-state ;; not good when specific on a buffer (org-icompleting-read "Choose new TODO state: " buffer-todo-keywords nil t)) (shared-note (read-string "Enter note for all marked items: "))) (dolist (marker org-agenda-bulk-marked-entries) (with-current-buffer (marker-buffer marker) (goto-char marker) (org-todo chosen-state) (org-add-log-setup 'state chosen-state nil nil) ;; Insert the shared note and finalize it. (org-add-log-note) (insert shared-note) (org-store-log-note)))))