Function: treemacs--expand-tag-node

treemacs--expand-tag-node is an autoloaded and byte-compiled function defined in treemacs-tags.el.

Signature

(treemacs--expand-tag-node BTN &optional RECURSIVE)

Documentation

Open tags node items for BTN.

Open all tag section under BTN when call is RECURSIVE.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-tags.el
;;;###autoload
(defun treemacs--expand-tag-node (btn &optional recursive)
  "Open tags node items for BTN.
Open all tag section under BTN when call is RECURSIVE."
  (let* ((index (treemacs-button-get btn :index))
         (tag-path (treemacs-button-get btn :path))
         (parent-dom-node (treemacs-find-in-dom tag-path))
         (recursive (treemacs--prefix-arg-to-recurse-depth recursive)))
    (treemacs--button-open
     :button btn
     :immediate-insert t
     :new-state 'tag-node-open
     :new-icon treemacs-icon-tag-open
     :open-action (treemacs--create-buttons
                   :nodes index
                   :depth (1+ (treemacs-button-get btn :depth))
                   :node-name item
                   :extra-vars ((leaf-prefix (concat prefix treemacs-icon-tag-leaf))
                                (node-prefix (concat prefix treemacs-icon-tag-closed)))
                   :node-action (if (imenu--subalist-p item)
                                    (treemacs--insert-tag-node
                                     item (append tag-path (list (car item))) node-prefix btn depth)
                                  (treemacs--insert-tag-leaf
                                   item (append tag-path (list (car item))) leaf-prefix btn depth)))
     :post-open-action
     (progn
       (-let [dom-nodes
              (--map (treemacs-dom-node->create!
                      :key (append tag-path (list (car it)))
                      :parent parent-dom-node)
                     index)]
         (-each dom-nodes #'treemacs-dom-node->insert-into-dom!)
         (setf (treemacs-dom-node->children parent-dom-node)
               (nconc dom-nodes (treemacs-dom-node->children parent-dom-node))))
       (treemacs-on-expand tag-path btn)
       (if (> recursive 0)
           (progn
             (cl-decf recursive)
             (--each (treemacs-collect-child-nodes btn)
               (when (eq 'tag-node-closed (treemacs-button-get it :state))
                 (goto-char (treemacs-button-start it))
                 (treemacs--expand-tag-node it t))))
         (treemacs--reentry tag-path))))))