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 Henrik Lissner
parent 7547cdac6d
commit c564c17a6b

View file

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