lang/org: reveal ancestors of point after saveplace

When opening an org file and the point is placed in a folded region (by
saveplace), it reveals the current subtree. Instead, it will reveal the
current subtree *and* its ancestors (and their siblings), which is more
intuitive.
This commit is contained in:
Henrik Lissner 2021-04-20 20:30:43 -04:00
parent 3e425ab2f2
commit 1d155d0c2f

View file

@ -470,13 +470,10 @@ All my (performant) foldings needs are met between this and `org-show-subtree'
"Unfold subtree around point if saveplace places us in a folded region." "Unfold subtree around point if saveplace places us in a folded region."
(and (not org-inhibit-startup) (and (not org-inhibit-startup)
(not org-inhibit-startup-visibility-stuff) (not org-inhibit-startup-visibility-stuff)
(org-invisible-p nil 'folding-only) ;; Must be done on a timer because `org-show-set-visibility' (used by
(or (not (org-on-heading-p)) ;; `org-reveal') relies on overlays that aren't immediately available
(not (member "ARCHIVE" (org-get-tags)))) ;; when `org-mode' first initializes.
(ignore-errors (run-at-time 0.1 nil #'org-reveal '(4))))
(save-excursion
(outline-previous-visible-heading 1)
(org-show-subtree)))))
;;;###autoload ;;;###autoload
(defun +org-remove-occur-highlights-h () (defun +org-remove-occur-highlights-h ()