From 1d155d0c2f9a783e9d1a133dd37eca3f079c1a75 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 20 Apr 2021 20:30:43 -0400 Subject: [PATCH] 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. --- modules/lang/org/autoload/org.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/lang/org/autoload/org.el b/modules/lang/org/autoload/org.el index 76800f3f2..2632cb698 100644 --- a/modules/lang/org/autoload/org.el +++ b/modules/lang/org/autoload/org.el @@ -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." (and (not org-inhibit-startup) (not org-inhibit-startup-visibility-stuff) - (org-invisible-p nil 'folding-only) - (or (not (org-on-heading-p)) - (not (member "ARCHIVE" (org-get-tags)))) - (ignore-errors - (save-excursion - (outline-previous-visible-heading 1) - (org-show-subtree))))) + ;; Must be done on a timer because `org-show-set-visibility' (used by + ;; `org-reveal') relies on overlays that aren't immediately available + ;; when `org-mode' first initializes. + (run-at-time 0.1 nil #'org-reveal '(4)))) ;;;###autoload (defun +org-remove-occur-highlights-h ()