Implement "show current thread only"
balta2ar opened this issue · 0 comments
balta2ar commented
From org-mode I miss a command to collapse all threads but the current one. For example:
before:
a
a1
a11
b
b1
b11 <-- cursor is here, we press "collapse-all-but-this-thread"
b22
b222
b223
c
c1
c11
after
a -- collapsed
b
b1
b11 <-- cursor is still here
b22 -- collapsed
c -- collapsed
in org-mode it's implemented as follows (from my config):
(defun ded/org-show-current-heading-tidily ()
"Show next entry, keeping other entries closed."
(interactive)
(if (save-excursion (end-of-line) (outline-invisible-p))
(progn (org-show-entry) (show-children))
(outline-back-to-heading)
(unless (and (bolp) (org-on-heading-p))
(org-up-heading-safe)
(hide-subtree)
(error "Boundary reached"))
(org-overview)
(org-reveal t)
(org-show-entry)
(recenter-top-bottom)
(show-children)
(recenter-top-bottom)))
(global-set-key (kbd "M-o") 'ded/org-show-current-heading-tidily)