Function: hierarchy-map-item
hierarchy-map-item is a byte-compiled function defined in
hierarchy.el.gz.
Signature
(hierarchy-map-item FUNC ITEM HIERARCHY &optional INDENT)
Documentation
Return the result of applying FUNC to ITEM and its descendants in HIERARCHY.
This function navigates the tree top-down: FUNCTION is first called on item and then on each of its children. Results are concatenated in a list.
INDENT is a number (default 0) representing the indentation of ITEM in HIERARCHY. FUNC should take 2 argument: the item and its indentation level.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/hierarchy.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Navigation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun hierarchy-map-item (func item hierarchy &optional indent)
"Return the result of applying FUNC to ITEM and its descendants in HIERARCHY.
This function navigates the tree top-down: FUNCTION is first called on item
and then on each of its children. Results are concatenated in a list.
INDENT is a number (default 0) representing the indentation of ITEM in
HIERARCHY. FUNC should take 2 argument: the item and its indentation
level."
(let ((indent (or indent 0)))
(cons
(funcall func item indent)
(seq-mapcat (lambda (child) (hierarchy-map-item func child
hierarchy (1+ indent)))
(hierarchy-children hierarchy item)))))