Don't unfold to 2nd level in org-mode by default

This is too opinionated to be a default, and has thus been replaced with
"unfold subtree around point when opening an org file", in case
saveplace has restored the point to a folded region.
This commit is contained in:
Henrik Lissner 2020-05-11 02:50:45 -04:00
parent 6c01d1a5ac
commit 31e4bfb2d4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 9 additions and 18 deletions

View file

@ -434,20 +434,14 @@ with `org-cycle')."
t))
;;;###autoload
(defun +org-unfold-to-2nd-level-or-point-h ()
"Alters '#+STARTUP overview' to only expand first-level headings.
Expands the first level, but no further. If a different startup option was
provided, do that instead."
(unless org-agenda-inhibit-startup
;; TODO Implement a custom #+STARTUP option?
(when (eq org-startup-folded t)
(outline-hide-sublevels +org-initial-fold-level))
;; If point was left somewhere deeper, unfold to point on startup.
(when (outline-invisible-p)
(ignore-errors
(save-excursion
(outline-previous-visible-heading 1)
(org-show-subtree))))))
(defun +org-make-last-point-visible-h ()
"Unfold subtree around point if saveplace places it to a folded region."
(and (not org-agenda-inhibit-startup)
(outline-invisible-p)
(ignore-errors
(save-excursion
(outline-previous-visible-heading 1)
(org-show-subtree)))))
;;;###autoload
(defun +org-remove-occur-highlights-h ()