fix(fold): +fold/next: actually support outlines
The docstring says that this function will move to the next folded outline heading, but this had not been implemented.
This commit is contained in:
parent
bff7baca69
commit
42ae401deb
1 changed files with 20 additions and 1 deletions
|
@ -219,7 +219,8 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +fold/next (count)
|
(defun +fold/next (count)
|
||||||
"Jump to the next vimish fold, outline heading or folded region."
|
"Jump to the next vimish fold, folded outline heading or folded
|
||||||
|
region."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(cl-loop with orig-pt = (point)
|
(cl-loop with orig-pt = (point)
|
||||||
for fn
|
for fn
|
||||||
|
@ -233,6 +234,24 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
|
||||||
(dotimes (_ count)
|
(dotimes (_ count)
|
||||||
(vimish-fold-previous-fold (- count)))))
|
(vimish-fold-previous-fold (- count)))))
|
||||||
(if (/= (point) orig-pt) (point)))
|
(if (/= (point) orig-pt) (point)))
|
||||||
|
(lambda ()
|
||||||
|
(when (or (bound-and-true-p outline-minor-mode)
|
||||||
|
(derived-mode-p 'outline-mode))
|
||||||
|
(cl-destructuring-bind
|
||||||
|
(count fn bound-fn)
|
||||||
|
(if (> count 0)
|
||||||
|
(list count
|
||||||
|
#'outline-next-visible-heading #'eobp)
|
||||||
|
(list (- count)
|
||||||
|
#'outline-previous-visible-heading #'bobp))
|
||||||
|
(dotimes (_ count)
|
||||||
|
(funcall fn 1)
|
||||||
|
(outline-end-of-heading)
|
||||||
|
(while (and (not (funcall bound-fn))
|
||||||
|
(not (outline-invisible-p)))
|
||||||
|
(funcall fn 1)
|
||||||
|
(outline-end-of-heading))))
|
||||||
|
(point)))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
;; ts-fold does not define movement functions so we need to do it ourselves
|
;; ts-fold does not define movement functions so we need to do it ourselves
|
||||||
(when (+fold--ts-fold-p)
|
(when (+fold--ts-fold-p)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue