Search code examples
emacsorg-mode

Hide org todo state changes in drawer or properties


How do I setup my org tree to store the TODO state changes into a drawer. The Logbook drawer works fine. The problem is that when i do a repeating entry each day it logs that. Making a huge tree under the tasks. Anyone know how to store this in :PROPERTIES: or another such drawer so that I still have this data, but it is not visible automatically?

Here is an example of it in my org file.

** TODO Weekly Review/Inbox Review (Planning) 
   DEADLINE: <2020-09-21 Mon ++1w>
   :PROPERTIES:
   :LAST_REPEAT: [2020-09-08 Tue 09:22]
   :Effort:   0:30
   :END:

   - State "DONE"       from "TODO"       [2020-09-08 Tue 09:22]
   - State "DONE"       from "TODO"       [2020-09-02 Wed 09:02]

I wish this was formated like this

** TODO Weekly Review/Inbox Review (Planning) 
   DEADLINE: <2020-09-21 Mon ++1w>
   :PROPERTIES:
   :LAST_REPEAT: [2020-09-08 Tue 09:22]
   :LOGTODOCHANGEDRAWER:
   - State "DONE"       from "TODO"       [2020-09-08 Tue 09:22]
   - State "DONE"       from "TODO"       [2020-09-02 Wed 09:02]
   :Effort:   0:30
   :END:

I don't care if it is in properties but I do not want these state changes listed 300times over again in plain text...it is very ugly


Solution

    • TLDR
    M-x customize-variable [RET] org-log-into-drawer
    

    Set value of org-log-into-drawer to "LOGBOOK"

    1. Background After Digging through the org manual I was able to come up with a solution. There is not an exact example within the manual, but by reading it you will likely get the understanding required to figure the solution out yourself. As always, just read through it if you have time and make sure that it all makes sense generally. Here is a link to page that is most closely related.

    https://orgmode.org/org.html#Tracking-TODO-state-changes

    https://orgmode.org/org.html#Drawers

    When using org-mode the style of tacking I was using for repeating tasks was habit. In the example below I have applied that explicitly through the properties drawer.

    When tracking a variable with org-habit there are 4 options for storage of logging. Each time the todo state change happens org-habit was logging the state change 'outside of a drawer'; which means that when the item is opened all of the state changes appear in plain text. By default this is the setup. There are 3 options currently available.

    To view these options go to customize-variable buffer for the "Org Process Group" inside of that you will find "Org Log Into Drawer" to get the todo state changes to write to the "Logbook" simply change to "logbook" In summary we could write out the initialization file to store in logbook using:

    METHOD 1: define globally using init.el

    ;; write todo state changes into LOGBOOK drawer
    (setq org-log-into-drawer “LOGBOOK”)
    

    METHOD 2: define for a specific tree

    * TODO test
      DEADLINE: <2020-09-22 Tue ++1w>
      :PROPERTIES:
      :STYLE: habit
      :LOG_INTO_DRAWER: t
      :LAST_REPEAT: [2020-09-08 Tue 10:41]
      :END:
      :LOGBOOK:
      - State "DONE"       from "TODO"       [2020-09-08 Tue 10:41]
      - State "DONE"       from "TODO"       [2020-09-08 Tue 10:40]
      :END:
    

    Method 3

    set this as provided by other contributor and both the state changes and the timer logs are placed inside the drawer.

    ;; inside init.el
    (setq org-log-done t)