I like to use the archive tag just to collapse the subtree automatically on opening the file (and also its gray coloring); I do not see why it should force me to use some esoteric hotkey (which my terminal emulator doesn't support) to expand the archived subtree. Any way to remove this limitation?
2 Answers
Yes, you can set the variable org-cycle-open-archived-trees
to t
and org-cycle
(to which TAB
is bound) will behave with archived trees as it does normally.
If you prefer to keep that variable's default value, you can instead bind a key sequence of your choice to the function org-force-cycle-archived
, e.g.
(define-key org-mode-map (kbd "C-c r") 'org-force-cycle-archived)
A third approach (and my preferred one) is to enable org speed keys and add a mapping to org-speed-commands-user
, like this
(setq org-use-speed-commands t)
(add-to-list 'org-speed-commands-user (cons "r" 'org-force-cycle-archived))
Then when point is at the very beginning of an archived subtree, pressing r
will unfold it.
(A disadvantage of allowing org-cycle
to operate on archived subtrees is that you typically do not want to expand them when point is on a parent heading. That's why I personally like to keep org-cycle-open-archived-trees
set to nil
.)
I got what I wanted (folded archive tags on startup but unfoldable by TAB
) with this config:
(setq org-startup-folded 'overview) ; @upstreambug https://github.com/hlissner/doom-emacs/issues/3693
(map!
:map evil-org-mode-map
:n
"TAB" 'org-force-cycle-archived
)
-
@NickD Adding this to
init.el
directly achieves what I have asked for. How is it not an answer? Commented Mar 24, 2021 at 8:29 -