I often do the following sequence in my
- Go to the root headline from current position
- Fold the whole subtree
Is there a way to this sequence with a shortcut?
The following code (lightly tested) takes advantage of the fact
org-mode is derived from
outline-mode, which allows you
to use the latter's functions. It simply jumps up headlines
until it can't go any further, and then hides the subtree.
(defun foldup () "Hide the entire subtree from root headline at point." (interactive) (while (ignore-errors (outline-up-heading 1))) (hide-subtree))
Bind it to your key of choice if you use it frequently.