Function: treemacs-find-node

treemacs-find-node is a byte-compiled function defined in treemacs-core-utils.el.

Signature

(treemacs-find-node PATH &optional PROJECT)

Documentation

Find position of node identified by PATH under PROJECT in the current buffer.

In spite of the signature this function effectively supports two different calling conventions.

The first one is for movement towards a node that identifies a normal file. In this case the signature is applied as is, and this function diverges simply into treemacs-goto-file-node. PATH is a file path string while PROJECT is a treemacs-project struct instance and fully optional, as treemacs is able to determine which project, if any, a given file belongs to. Providing the project when it happens to be available is therefore only a small optimisation. If PROJECT is not given it will be found with treemacs--find-project-for-path. No attempt is made to verify that PATH actually falls under a project in the workspace. It is assumed that this check has already been made.

The second calling convention deals with custom nodes defined by an extension for treemacs. In this case the PATH is made up of all the node keys that lead to the node to be moved to and PROJECT is not used.

Either way this function will return a marker to the moved-to position if it was successful.

PATH: Filepath | Node Path PROJECT Project Struct

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-core-utils.el
(defun treemacs-find-node (path &optional project)
  "Find position of node identified by PATH under PROJECT in the current buffer.

In spite of the signature this function effectively supports two different
calling conventions.

The first one is for movement towards a node that identifies a normal file.  In
this case the signature is applied as is, and this function diverges simply into
`treemacs-goto-file-node'.  PATH is a file path string while PROJECT is a
`treemacs-project' struct instance and fully optional, as treemacs is able to
determine which project, if any, a given file belongs to.  Providing the project
when it happens to be available is therefore only a small optimisation.  If
PROJECT is not given it will be found with `treemacs--find-project-for-path'.
No attempt is made to verify that PATH actually falls under a project in the
workspace.  It is assumed that this check has already been made.

The second calling convention deals with custom nodes defined by an extension
for treemacs.  In this case the PATH is made up of all the node keys that lead
to the node to be moved to and PROJECT is not used.

Either way this function will return a marker to the moved-to position if it was
successful.

PATH: Filepath | Node Path
PROJECT Project Struct"
  (save-excursion
    (treemacs-with-path path
      :file-action (when (and (eq t treemacs--in-this-buffer)
                              (file-exists-p path))
                     (treemacs-find-file-node path project))
      :extension-action (treemacs--find-custom-node path))))