2

I would like to be able to set a keyword or tag for a subtree, which hides all todos in DONE states.

The Video of John Cleese about creativity states inspired me. He says that we enter a "closed mode" for getting work done, like going through a tunnel and at the end switch back in "open mode" for creative/planning tasks.

I would like such a "tunnel"-keyword or tag to help me focus on getting all tasks of a subtree done by hiding the DONE tasks (on the fly) as long as the keyword or tag persists. Maybe something similar to the COMMENT keyword before the heading.

I fear that archiving destroys the tree structure (e. g. for clock reports or later review). I would like to archive the whole project tree after a project is finished. Sparse trees don't update on the fly and I can not close and expand the parent heading without showing all the children again.

Example: 

open mode / normal

* Heading 1
** TODO One Thing
** DONE Other Thing
* Heading 2
** DONE Another Thing

variant closed mode - with keyword like COMMENT

* TUNNEL Heading 1
** TODO One Thing
* Heading 2
** DONE Another Thing

variant closed mode - with tag

* Heading 1 :tunnel:
** TODO One Thing
* Heading 2
** DONE Another Thing

I am new to Emacs.

2
  • Please don't use tag elisp for questions about using Elisp. Use it only for questions about the language itself, compared with other languages, in particular, other Lisp dialects. Thx.
    – Drew
    Commented Apr 10, 2020 at 17:17
  • 2
    The TODO agenda does this - for all files defined as "agenda files", for one specific file, or one subtree in a file. You can mark items DONE in the agenda view or the Org file, and that item will disappear from the agenda view (after a refresh). If the agenda view is too restrictive to do your work, you can choose one item to work on, hit enter to go to the Org item, then narrow to just that item. Narrowing can be done by hitting d if you have org-use-speed-commands set to t
    – gregoryg
    Commented Sep 3, 2020 at 0:32

1 Answer 1

0

I have a temporary workaround, which does not solve the problem, but lowers the impact of the cause.

I apply the ARCHIVE tag when marking a task DONE. Headlines with the ARCHIVE tag can be formatted specially.

(setq org-todo-state-tags-triggers
  (quote 
  (("DONE" ("ARCHIVE" . t)) ;; Set ARCHIVE tag when state changes to DONE
   ("" ("ARCHIVE"))         ;; Unset ARCHIVE tag when state changes to "" (no state)
  )))

Then I set the org-archived face to a light color via customize. I use a white background and also lower the font size a bit.

'(org-archived ((t (:foreground honewydew2 :height 0.8))))

Now DONE tasks are not really hidden, but loose a lot of visual attention. All headings with the ARCHIVE tag are now a lot less visible. Switching to the stateless state removes the ARCHIVE tag and makes the headings visible again.

For review I use Ctrl-c @ to mark a subtree. When marked the DONE tasks have a black color and are clearly readable again.

Headings with the ARCHIVE tag can only be expanded by pressing Ctrl TAB and not by pressing just TAB as usual. Subtrees of those headings are displayed with the normal face.

Update 16. June 2020: This method has some drawbacks since every task in every file is automatically archived and does not show up in agenda clock report any more and habits can not be tracked like this.

2
  • 1
    Why not use the agenda, rather than the agenda files? @gregoryg's comment is spot-on. Let the agenda drive your work.
    – NickD
    Commented Aug 28, 2021 at 22:22
  • Agreed, this is the purpose of custom agenda views. (I've struggled with this too, my instinct is to just work in the files directly but the agenda features are very flexible for building your workflow.)
    – glucas
    Commented 2 days ago

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.