Function: kview:map-tree
kview:map-tree is a byte-compiled function defined in kview.el.
Signature
(kview:map-tree FUNC KVIEW &optional TOP-P VISIBLE-P)
Documentation
Apply FUNC to the tree starting at point within KVIEW; return results as a list.
With optional TOP-P non-nil, maps over all of kview's cells. With optional VISIBLE-P, considers only those cells that are visible in the view.
FUNC should take one argument, the kview with the tree to map, and should operate upon the cell at point.
The variable cell-indent contains the indentation value of the
first cell mapped when FUNC is called so that it may be tested
against this value. The variable lbl-sep-len contains the label
separator length.
See also kview:map-region, kview:map-branch and kview:map-siblings.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kview.el
(defun kview:map-tree (func kview &optional top-p visible-p)
"Apply FUNC to the tree starting at point within KVIEW; return results as a list.
With optional TOP-P non-nil, maps over all of kview's cells.
With optional VISIBLE-P, considers only those cells that are visible in the
view.
FUNC should take one argument, the kview with the tree to map, and
should operate upon the cell at point.
The variable `cell-indent' contains the indentation value of the
first cell mapped when FUNC is called so that it may be tested
against this value. The variable `lbl-sep-len' contains the label
separator length.
See also `kview:map-region', `kview:map-branch' and `kview:map-siblings'."
(with-current-buffer (kview:buffer kview)
(save-excursion
(let ((results)
(lbl-sep-len (kview:label-separator-length kview))
cell-indent)
(if top-p
(progn (goto-char (point-min))
(kview:end-of-actual-line)
;; Terminate when no further cells to process.
(while (progn (setq results (cons (funcall func kview) results))
(kcell-view:next visible-p lbl-sep-len))))
;; Next line ensures point is in the root of the current tree if
;; the tree is at all hidden.
(kotl-mode:beginning-of-line)
(setq cell-indent (kcell-view:indent nil lbl-sep-len))
;; Terminate when no further cells or when reach a cell at an equal
;; or higher level in the kotl than the first cell that we processed.
(while (and (setq results (cons (funcall func kview) results))
(kcell-view:next visible-p lbl-sep-len)
(>= (- (kcell-view:indent nil lbl-sep-len) cell-indent)
(kview:level-indent kview)))))
(nreverse results)))))