fix(org): update +org--more-startup-folded-options-a
With the introduction of org-fold, this advice (which adds support for a special family of visibility #+startup options) needed to be updated.
This commit is contained in:
parent
9cb4c8b637
commit
dd83c455ba
1 changed files with 9 additions and 4 deletions
|
@ -696,15 +696,19 @@ mutating hooks on exported output, like formatters."
|
||||||
(defadvice! +org--more-startup-folded-options-a ()
|
(defadvice! +org--more-startup-folded-options-a ()
|
||||||
"Adds support for 'showNlevels*' startup options.
|
"Adds support for 'showNlevels*' startup options.
|
||||||
Unlike showNlevels, this will also unfold parent trees."
|
Unlike showNlevels, this will also unfold parent trees."
|
||||||
:before #'org-set-startup-visibility
|
:before-until #'org-cycle-set-startup-visibility
|
||||||
(when-let (n (pcase org-startup-folded
|
(when-let (n (pcase org-startup-folded
|
||||||
(`show2levels* 2)
|
(`show2levels* 2)
|
||||||
(`show3levels* 3)
|
(`show3levels* 3)
|
||||||
(`show4levels* 4)
|
(`show4levels* 4)
|
||||||
(`show5levels* 5)))
|
(`show5levels* 5)))
|
||||||
(org-show-all '(headings drawers))
|
(org-fold-show-all '(headings))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
|
(save-restriction
|
||||||
|
(narrow-to-region (point-min) (or (re-search-forward org-outline-regexp-bol nil t) (point-max)))
|
||||||
|
(org-fold-hide-drawer-all))
|
||||||
|
(goto-char (point-max))
|
||||||
(let ((regexp (if (and (wholenump n) (> n 0))
|
(let ((regexp (if (and (wholenump n) (> n 0))
|
||||||
(format "^\\*\\{%d,%d\\} " (1- n) n)
|
(format "^\\*\\{%d,%d\\} " (1- n) n)
|
||||||
"^\\*+ "))
|
"^\\*+ "))
|
||||||
|
@ -712,8 +716,9 @@ Unlike showNlevels, this will also unfold parent trees."
|
||||||
(while (re-search-backward regexp nil t)
|
(while (re-search-backward regexp nil t)
|
||||||
(when (or (not (wholenump n))
|
(when (or (not (wholenump n))
|
||||||
(= (org-current-level) n))
|
(= (org-current-level) n))
|
||||||
(org-flag-region (line-end-position) last t 'outline))
|
(org-fold-core-region (line-end-position) last t 'outline))
|
||||||
(setq last (line-end-position 0)))))))
|
(setq last (line-end-position 0)))))
|
||||||
|
t))
|
||||||
|
|
||||||
;; Some uses of `org-fix-tags-on-the-fly' occur without a check on
|
;; Some uses of `org-fix-tags-on-the-fly' occur without a check on
|
||||||
;; `org-auto-align-tags', such as in `org-self-insert-command' and
|
;; `org-auto-align-tags', such as in `org-self-insert-command' and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue