fix(fold): reorder fold type checks

(+fold--ts-fold-p) just checks that the mode is active so it will block
any checks following it. Move it to the end so other fold types have a
chance, and consistently order fold type checks.
This commit is contained in:
Ian McCowan 2023-11-06 09:11:09 -08:00 committed by Yann Esposito (Yogsototh)
parent ef3d30a9a2
commit 9288d6a5e4
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -75,8 +75,8 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(cl-letf (((symbol-function #'outline-hide-subtree)
(symbol-function #'outline-hide-entry)))
(outline-toggle-children)))
((+fold--ts-fold-p) (ts-fold-toggle))
((+fold--hideshow-fold-p) (+fold-from-eol (hs-toggle-hiding))))))
((+fold--hideshow-fold-p) (+fold-from-eol (hs-toggle-hiding)))
((+fold--ts-fold-p) (ts-fold-toggle)))))
;;;###autoload
(defun +fold/open ()
@ -89,8 +89,8 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
((+fold--outline-fold-p)
(outline-show-children)
(outline-show-entry))
((+fold--ts-fold-p) (ts-fold-open))
((+fold--hideshow-fold-p) (+fold-from-eol (hs-show-block))))))
((+fold--hideshow-fold-p) (+fold-from-eol (hs-show-block)))
((+fold--ts-fold-p) (ts-fold-open)))))
;;;###autoload
(defun +fold/close ()
@ -100,9 +100,9 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(interactive)
(save-excursion
(cond ((+fold--vimish-fold-p) (vimish-fold-refold))
((+fold--ts-fold-p) (ts-fold-close))
((+fold--outline-fold-p) (outline-hide-subtree))
((+fold--hideshow-fold-p) (+fold-from-eol (hs-hide-block)))
((+fold--outline-fold-p) (outline-hide-subtree)))))
((+fold--ts-fold-p) (ts-fold-close)))))
;;;###autoload
(defun +fold/open-all (&optional level)