8

I have this in an Org mode projects file:

#+TODO: TODO(t!) WAITING(w!) DONE(d!) CANCELED(c@)

When I move something from TODO to WAITING, it adds a timestamp without asking for a note. That's fine 8 or 9 times out of 10 ... but sometimes I want to add a note too.

If I use the @ it will always ask me for a note, and I have to C-c C-c to get out of that. I'd like to avoid that if I can.

Is there a way (a prefix or alternate command) that I can use to have Org let me add an optional note when I change a TODO state?

C-c C-z (org-add-note) adds a note, but it does it to the item as a whole, not to the WAITING workflow change, like so:

* WAITING Find out how to sometimes add a note when I change to WAITING
  - Note taken on [2014-09-23 Tue 11:36] \\
    Asked on SE
  - State "WAITING"    from "WAITING"    [2014-09-23 Tue 11:30]
  - State "WAITING"    from "TODO"       [2014-09-21 Sun 11:25]
8

First of all, note that passing a argument of 0 to org-todo would inhibit notes. So if you're willing to inverse the default state of everything, it might work for you.

But it'd be cleaner to force a note, which does not have a similar flag, unfortunately.

Here's something you can do to simulate that.

(defun org-todo-force-notes ()
  (interactive)
  (let ((org-todo-log-states
         (mapcar (lambda (state)
                   (list state 'note 'time))
                 (apply 'append org-todo-sets))))
    (call-interactively 'org-todo)))

(define-key org-mode-map (kbd "C-c C-S-t") 'org-todo-force-notes)

Explanation: Here I'm temporarily redefining the note-taking semantic that's associated with all todo keywords (they're organized in sets in org-todo-sets, a flat representation might be available in another variable) to force note-taking, and passing that as a dynamic context to the actual org-todo code. So whenever hitting C-c C-T (uppercase T), you force a note, regardless of what state you'll end up with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.