Rename path finding funcs

This commit is contained in:
Greg Sexton 2014-04-19 15:04:42 +01:00
parent 9c5a4acf60
commit 2be3fa7916

View File

@ -153,7 +153,7 @@ used to nil out data. This mutates the node."
(cons tree (origami-fold-find-deepest child pred)) (cons tree (origami-fold-find-deepest child pred))
(list tree))))) (list tree)))))
(defun origami-fold-find-node-with-range (tree beg end) (defun origami-fold-find-path-with-range (tree beg end)
"Return the path to the most specific (deepest) node that has "Return the path to the most specific (deepest) node that has
exactly the range BEG-END, or null." exactly the range BEG-END, or null."
(-when-let (path (origami-fold-find-deepest tree (-when-let (path (origami-fold-find-deepest tree
@ -165,7 +165,7 @@ exactly the range BEG-END, or null."
(= end (origami-fold-end last))) (= end (origami-fold-end last)))
path)))) path))))
(defun origami-fold-find-node-containing (tree point) (defun origami-fold-find-path-containing (tree point)
"Return the path to the most specific (deepest) node that "Return the path to the most specific (deepest) node that
contains point, or null." contains point, or null."
(origami-fold-find-deepest tree (origami-fold-find-deepest tree
@ -365,13 +365,13 @@ consumed count."
(defun origami-was-previously-open? (tree) (defun origami-was-previously-open? (tree)
(lambda (beg end) (lambda (beg end)
(-if-let (node (-last-item (origami-fold-find-node-with-range tree beg end))) (-if-let (node (-last-item (origami-fold-find-path-with-range tree beg end)))
(origami-fold-open-p node) (origami-fold-open-p node)
t))) t)))
(defun origami-previous-data (tree) (defun origami-previous-data (tree)
(lambda (beg end) (lambda (beg end)
(-> (origami-fold-find-node-with-range tree beg end) (-> (origami-fold-find-path-with-range tree beg end)
-last-item -last-item
origami-fold-data))) origami-fold-data)))
@ -396,7 +396,7 @@ otherwise fetch cached tree."
(defun origami-open-node (buffer point) (defun origami-open-node (buffer point)
(interactive (list (current-buffer) (point))) (interactive (list (current-buffer) (point)))
(let ((tree (origami-get-fold-tree buffer))) (let ((tree (origami-get-fold-tree buffer)))
(-when-let (path (origami-fold-find-node-containing tree point)) (-when-let (path (origami-fold-find-path-containing tree point))
(debug-msg "open path: %s" path) (debug-msg "open path: %s" path)
(origami-fold-diff tree (origami-store-cached-tree buffer (origami-fold-diff tree (origami-store-cached-tree buffer
(origami-fold-open-set path t)) (origami-fold-open-set path t))
@ -407,7 +407,7 @@ otherwise fetch cached tree."
(defun origami-close-node (buffer point) (defun origami-close-node (buffer point)
(interactive (list (current-buffer) (point))) (interactive (list (current-buffer) (point)))
(let ((tree (origami-get-fold-tree buffer))) (let ((tree (origami-get-fold-tree buffer)))
(-when-let (path (origami-fold-find-node-containing tree point)) (-when-let (path (origami-fold-find-path-containing tree point))
(origami-fold-diff tree (origami-store-cached-tree buffer (origami-fold-diff tree (origami-store-cached-tree buffer
(origami-fold-open-set path nil)) (origami-fold-open-set path nil))
(origami-create-overlay-from-fold-tree-fn buffer) (origami-create-overlay-from-fold-tree-fn buffer)