Add origami-toggle-all-nodes
This commit is contained in:
parent
ec68e37557
commit
7e878a2251
@ -101,6 +101,11 @@ The following commands are supplied to manipulate folds in the buffer:
|
||||
<td>Close every fold in the buffer.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>origami-toggle-all-nodes</td>
|
||||
<td>Toggle open/closed every fold node in the buffer.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>origami-show-only-node</td>
|
||||
<td>Close everything but the folds necessary to see the point. Very useful for concentrating on an area of code.</td>
|
||||
|
10
origami.el
10
origami.el
@ -525,6 +525,16 @@ familiar. It's easiest to grasp this just by giving it a go."
|
||||
(origami-fold-open-set node nil))
|
||||
tree)))))
|
||||
|
||||
(defun origami-toggle-all-nodes (buffer)
|
||||
"Toggle all fold nodes in the buffer recursively open or
|
||||
recursively closed."
|
||||
(interactive (list (current-buffer)))
|
||||
(-when-let (tree (origami-get-fold-tree buffer))
|
||||
;; use the first child as root is always open
|
||||
(if (-> tree origami-fold-children car origami-fold-open?)
|
||||
(origami-close-all-nodes buffer)
|
||||
(origami-open-all-nodes buffer))))
|
||||
|
||||
(defun origami-show-only-node (buffer point)
|
||||
"Close all fold nodes in BUFFER except for those necessary to
|
||||
make POINT visible. Very useful for quickly collapsing everything
|
||||
|
Loading…
Reference in New Issue
Block a user