Function: treemacs-on-collapse

treemacs-on-collapse is a byte-compiled function defined in treemacs-dom.el.

Signature

(treemacs-on-collapse KEY &optional PURGE)

Documentation

Re-arrange the dom when node at KEY was collapsed.

Will remove NODE's parent/child link and invalidate the position and refresh data of NODE and all its children. When PURGE is non-nil will instead remove NODE and its children from the dom.

KEY: Node Path Purge: Boolean

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-dom.el
(define-inline treemacs-on-collapse (key &optional purge)
  "Re-arrange the dom when node at KEY was collapsed.
Will remove NODE's parent/child link and invalidate the position and refresh
data of NODE and all its children.  When PURGE is non-nil will instead remove
NODE and its children from the dom.

KEY: Node Path
Purge: Boolean"
  (inline-letevals (key purge)
    (inline-quote
     (let* ((dom-node (treemacs-find-in-dom ,key))
            (children (treemacs-dom-node->children dom-node)))
       (-when-let (parent-dom-node (treemacs-dom-node->parent dom-node))
         (setf (treemacs-dom-node->reentry-nodes parent-dom-node)
               (delete dom-node (treemacs-dom-node->reentry-nodes parent-dom-node))))
       (cond
        (,purge
         (treemacs--on-purged-collapse dom-node))
        (children
         (treemacs--on-collapse-of-node-with-children dom-node))
        (t
         (treemacs--on-collapse-of-node-without-children dom-node)))))))