Add recursive open/close

This commit is contained in:
Greg Sexton 2014-06-02 20:19:43 +01:00
parent 84ee2e8dcb
commit 053c2c7ac8

View File

@ -494,6 +494,17 @@ otherwise fetch cached tree."
(origami-apply-new-tree buffer tree (origami-fold-assoc path (lambda (node)
(origami-fold-open-set node t)))))))
(defun origami-open-node-recursively (buffer point)
(interactive (list (current-buffer) (point)))
(-when-let (tree (origami-get-fold-tree buffer))
(-when-let (path (origami-fold-find-path-containing tree point))
(origami-apply-new-tree
buffer tree (origami-fold-assoc path
(lambda (node)
(origami-fold-map (lambda (node)
(origami-fold-open-set node t))
node)))))))
(defun origami-show-node (buffer point)
"Like `origami-open-node' but opens parent nodes recursively so
as to ensure seeing where POINT is."
@ -513,6 +524,17 @@ as to ensure seeing where POINT is."
path (lambda (node)
(origami-fold-open-set node nil)))))))
(defun origami-close-node-recursively (buffer point)
(interactive (list (current-buffer) (point)))
(-when-let (tree (origami-get-fold-tree buffer))
(-when-let (path (origami-fold-find-path-containing tree point))
(origami-apply-new-tree
buffer tree (origami-fold-assoc path
(lambda (node)
(origami-fold-map (lambda (node)
(origami-fold-open-set node nil))
node)))))))
(defun origami-toggle-node (buffer point)
(interactive (list (current-buffer) (point)))
(-when-let (tree (origami-get-fold-tree buffer))