Function: treemacs--create-buttons
treemacs--create-buttons is a macro defined in treemacs-rendering.el.
Signature
(treemacs--create-buttons &key NODES NODE-ACTION DEPTH EXTRA-VARS NODE-NAME)
Documentation
Building block macro for creating buttons from a list of NODES.
Will not making any insertions, but instead return a list of strings created by NODE-ACTION, so that the list can be further manipulated and efficiently inserted in one go. NODES is the list to create buttons from. DEPTH is the indentation level buttons will be created on. EXTRA-VARS are additional var bindings inserted into the initial let block. NODE-ACTION is the button creating form inserted for every NODE. NODE-NAME is the variable individual nodes are bound to in NODE-ACTION.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-rendering.el
(cl-defmacro treemacs--create-buttons (&key nodes node-action depth extra-vars node-name)
"Building block macro for creating buttons from a list of NODES.
Will not making any insertions, but instead return a list of strings created by
NODE-ACTION, so that the list can be further manipulated and efficiently
inserted in one go.
NODES is the list to create buttons from.
DEPTH is the indentation level buttons will be created on.
EXTRA-VARS are additional var bindings inserted into the initial let block.
NODE-ACTION is the button creating form inserted for every NODE.
NODE-NAME is the variable individual nodes are bound to in NODE-ACTION."
`(let* ((depth ,depth)
(prefix (concat "\n" (treemacs--get-indentation depth)))
(,node-name (car ,nodes))
(strings)
,@extra-vars)
;; extensions only implicitly use the prefix by calling into `treemacs-render-node'
;; (ignore prefix)
(when ,node-name
(dolist (,node-name ,nodes)
(--each ,node-action
(push it strings))))
(nreverse strings)))