Function: treemacs-do-insert-single-node

treemacs-do-insert-single-node is a byte-compiled function defined in treemacs-rendering.el.

Signature

(treemacs-do-insert-single-node PATH PARENT-PATH)

Documentation

Insert single file node at given PATH and below PARENT-PATH.

PATH: File Path PARENT-PATH: File Path

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-rendering.el
(defun treemacs-do-insert-single-node (path parent-path)
  "Insert single file node at given PATH and below PARENT-PATH.

PATH: File Path
PARENT-PATH: File Path"
  (-when-let (parent-dom-node (treemacs-find-in-dom parent-path))
    (if (treemacs-find-in-dom path)
        ;; "creating" a file that is already present may happen due to an interaction in magit
        ;; in that case we need to checkthe file's git status
        (treemacs-update-single-file-git-state path)
      (let* ((parent-btn (treemacs-dom-node->position parent-dom-node))
             (parent-flatten-info (treemacs-button-get parent-btn :collapsed)))
        (treemacs-with-writable-buffer
         (if parent-flatten-info
             (treemacs--insert-node-in-flattened-directory
              path parent-btn parent-dom-node parent-flatten-info)
           (treemacs--insert-single-node
            path parent-btn parent-dom-node)))))))