I often do the following sequence in my org-mode
file:
- Go to the root headline from current position
- Fold the whole subtree
Is there a way to this sequence with a shortcut?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI often do the following sequence in my org-mode
file:
Is there a way to this sequence with a shortcut?
The following code (lightly tested) takes advantage of the fact
that 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.