Fix #3693: don't unfold archive trees on file-open

Also refactors +org-make-last-point-visible-h to be more realistic about
when it should and shouldn't expand the hidden region at point. Since
org-agenda-inhibit-startup is now non-nil by default it makes no sense
to test it (and it was a poor choice to begin with).

Plus, instead of using outline's API, better to use org's, even if
they're aliases or wrappers. Less of a maintenance burden.
This commit is contained in:
Henrik Lissner 2020-08-05 15:00:34 -04:00
parent 77fbde957a
commit d81ef69525
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -470,8 +470,11 @@ All my (performant) foldings needs are met between this and `org-show-subtree'
;;;###autoload
(defun +org-make-last-point-visible-h ()
"Unfold subtree around point if saveplace places us in a folded region."
(and (not org-agenda-inhibit-startup)
(outline-invisible-p)
(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)