diff --git a/modules/lang/org/autoload/org.el b/modules/lang/org/autoload/org.el index e66d03a09..c6266d55d 100644 --- a/modules/lang/org/autoload/org.el +++ b/modules/lang/org/autoload/org.el @@ -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 () diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 2079b5d01..f358a39c7 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -50,9 +50,6 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default (defvar +org-capture-projects-file "projects.org" "Default, centralized target for org-capture templates.") -(defvar +org-initial-fold-level 2 - "The initial fold level of org files when no #+STARTUP options for it.") - (defvar +org-habit-graph-padding 2 "The padding added to the end of the consistency graph") @@ -991,7 +988,7 @@ compelling reason, so..." #'doom-disable-show-trailing-whitespace-h #'+org-enable-auto-reformat-tables-h #'+org-enable-auto-update-cookies-h - #'+org-unfold-to-2nd-level-or-point-h) + #'+org-make-last-point-visible-h) (add-hook! 'org-load-hook #'+org-init-org-directory-h