feat(fold): add ts-fold support to wrappers
Changes: - add +fold--ts-fold-p which only checks if the feature is around - add ts-fold into +fold/toggle, +fold/open, +fold/close - update doc strings
This commit is contained in:
parent
83d22fe5ef
commit
c1f640209a
1 changed files with 10 additions and 3 deletions
|
@ -32,6 +32,10 @@
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
(+fold--hideshow-fold-p))))))
|
(+fold--hideshow-fold-p))))))
|
||||||
|
|
||||||
|
;; NOTE: does this need more?
|
||||||
|
(defun +fold--ts-fold-p ()
|
||||||
|
(featurep 'ts-fold))
|
||||||
|
|
||||||
(defun +fold--invisible-points (count)
|
(defun +fold--invisible-points (count)
|
||||||
(let (points)
|
(let (points)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -62,7 +66,7 @@
|
||||||
(defun +fold/toggle ()
|
(defun +fold/toggle ()
|
||||||
"Toggle the fold at point.
|
"Toggle the fold at point.
|
||||||
|
|
||||||
Targets `vimmish-fold', `hideshow' and `outline' folds."
|
Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(cond ((+fold--vimish-fold-p) (vimish-fold-toggle))
|
(cond ((+fold--vimish-fold-p) (vimish-fold-toggle))
|
||||||
|
@ -70,29 +74,32 @@ Targets `vimmish-fold', `hideshow' 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))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +fold/open ()
|
(defun +fold/open ()
|
||||||
"Open the folded region at point.
|
"Open the folded region at point.
|
||||||
|
|
||||||
Targets `vimmish-fold', `hideshow' and `outline' folds."
|
Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(cond ((+fold--vimish-fold-p) (vimish-fold-unfold))
|
(cond ((+fold--vimish-fold-p) (vimish-fold-unfold))
|
||||||
((+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))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +fold/close ()
|
(defun +fold/close ()
|
||||||
"Close the folded region at point.
|
"Close the folded region at point.
|
||||||
|
|
||||||
Targets `vimmish-fold', `hideshow' and `outline' folds."
|
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--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--outline-fold-p) (outline-hide-subtree)))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue