1

I find it quite useful to have the log of when I completed a task in org mode, but get a bit annoyed at the fact that when a TODO is changed to DONE, the log is visible. Is it possible to have it always folded (even when toggling between TODO and DONE) so that the log entry is only visible if I specifically open it?

Thanks!

EDIT: Added screenshot to show how it is now and how it should look like enter image description here

3
  • 1
    Are you aware about (setq org-log-state-notes-into-drawer t) maybe this is what you want? All log related information will stay inside of logbook with this. Oct 7, 2021 at 10:20
  • Thanks for your help. That is a bit nicer to look at, but still there is the CLOSED: line and the logbook line underneath. They don't bother me in general, it just bothers me that they are unfolded. I'll add some screenshots to make more clear what I mean:) Oct 14, 2021 at 8:03
  • I don't know of anything pre-existing, but you may be able to do something with the org-trigger-hook which is run on state changes. The trick would be to write a function that folds the subtree rooted at the DONE headline.
    – NickD
    Oct 14, 2021 at 16:16

1 Answer 1

0

I haven't found a nice way to do it, but since the state update message seems to be added last (and after any hooks), I found that the following works for me:

(defun creichen/org-close-done ()
  (when (equal (org-get-todo-state) "DONE")
    (hide-subtree)))

(advice-add 'org-store-log-note :after 'creichen/org-close-done)

Your Answer

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

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