diff options
Diffstat (limited to 'pearl.el')
| -rw-r--r-- | pearl.el | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -250,13 +250,23 @@ Returns HEADING unchanged when IDENTIFIER is empty or absent from the front." (cond ((fboundp 'org-fold-hide-drawer-all) (org-fold-hide-drawer-all)) ((fboundp 'org-cycle-hide-drawers) (org-cycle-hide-drawers 'all)))) +(defun pearl--hide-or-tidy-drawers () + "Hide property drawers in the accessible buffer, honoring org-tidy if active. +With `org-tidy-mode' on, re-tidy via `org-tidy-buffer' so freshly rendered +drawers pick up org-tidy's compact display instead of a plain fold; otherwise +fold them natively. org-tidy stays an optional soft dependency -- the native +fold is the fallback when it is absent or off." + (if (and (bound-and-true-p org-tidy-mode) (fboundp 'org-tidy-buffer)) + (org-tidy-buffer) + (pearl--hide-all-drawers))) + (defun pearl--hide-drawers-in-region (start end) "Collapse property drawers between START and END. Used after inserting a single subtree (a freshly added comment) so its drawer folds shut like the rest of the page, rather than rendering expanded." (save-restriction (narrow-to-region start end) - (pearl--hide-all-drawers))) + (pearl--hide-or-tidy-drawers))) (defun pearl--restore-page-visibility () "Re-fold the whole current buffer to its `#+STARTUP' visibility and hide drawers. @@ -273,7 +283,7 @@ not sprawl open. A no-op when `pearl-fold-after-update' is nil." (funcall (if (fboundp 'org-cycle-set-startup-visibility) 'org-cycle-set-startup-visibility 'org-set-startup-visibility)) - (pearl--hide-all-drawers))) + (pearl--hide-or-tidy-drawers))) ;; Cache variables @@ -2363,7 +2373,7 @@ matches a first fetch." (goto-char beg) (save-restriction (org-narrow-to-subtree) - (pearl--hide-all-drawers))))))) + (pearl--hide-or-tidy-drawers))))))) ;;;###autoload (defun pearl-refresh-current-issue () |
