Q: Which function does org-mode use to log a note with a TODO state change?


org-mode provides the option of adding a note when tracking TODO state changes. That's great.

However, org is also cavalier about changing my window configuration when it adds notes (i.e., it temporarily changes the frame to a two-window layout), which is infuriating.

I've resolved the issue in a different setting when dealing with capture templates by tracking down the offending function (org-capture-place-template) and commenting out the offending line that changes my window configuration.


I cannot find the analogous function for dealing with todo state changes. The org source code is sometimes rather baroque, and I've gone through the source for org-todo without finding the relevant call. I suspect it's the same problem with a hard-coded change to the window configuration that I need to comment out.

So: what function does org use to log the NOTE with a TODO state change?

  • Looks like it adds org-add-log-note to post-command-hook within org-add-log-setup from org-todo.
    – wasamasa
    Sep 9, 2016 at 16:56
  • @wasamasa: yes, that was definitely the one, thank you. Please post it as an answer so I can accept it. For what it's worth, commenting out the (delete-other-windows) line resolves the window-spamming problem.
    – Dan
    Sep 9, 2016 at 17:00

1 Answer 1


I've dug into Org a few times before, so how hard could this possibly be? Well, the location is somewhat unusual. If you follow along the sources of org-todo, you can see some comments about state changes to the TODO:

(when (and now-done-p org-log-done)
  ;; It is now done, and it was not done before
  (org-add-planning-info 'closed (org-current-effective-time))
  (if (and (not dolog) (eq 'note org-log-done))
      (org-add-log-setup 'done org-state this 'findpos 'note)))

According to its docstring, org-add-log-setup adds a helper function to post-command-hook:

(add-hook 'post-command-hook 'org-add-log-note 'append)

From this one can assume that org-add-log-note is the one we're looking for.

  • Thanks for tracking it down. I indeed missed it when scanning through the code. In my half-hearted defense, it's buried pretty deeply around the function's 200th line with cryptic comments.
    – Dan
    Sep 9, 2016 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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