Function: hierarchy-leafs
hierarchy-leafs is a byte-compiled function defined in
hierarchy.el.gz.
Signature
(hierarchy-leafs HIERARCHY &optional NODE)
Documentation
Return all leafs of HIERARCHY.
A leaf is an item with no child.
If NODE is an item of HIERARCHY, only return leafs under NODE.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/hierarchy.el.gz
(defun hierarchy-leafs (hierarchy &optional node)
"Return all leafs of HIERARCHY.
A leaf is an item with no child.
If NODE is an item of HIERARCHY, only return leafs under NODE."
(let ((leafs (cl-set-difference
(map-keys (hierarchy--seen-items hierarchy))
(map-keys (hierarchy--children hierarchy)))))
(if (hierarchy-has-item hierarchy node)
(seq-filter (lambda (item)
(hierarchy-descendant-p hierarchy item node))
leafs)
leafs)))