Function: treemacs--nearest-path

treemacs--nearest-path is a byte-compiled function defined in treemacs-core-utils.el.

Signature

(treemacs--nearest-path BTN)

Documentation

Return the file path of the BTN.

If the :path property is not set or not a file, keep looking upward, via the
:parent property. Useful to e.g. find the path of the file of the currently
selected tags or extension entry. Must be called from treemacs buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-core-utils.el
(defun treemacs--nearest-path (btn)
  "Return the file path of the BTN.
If the `:path' property is not set or not a file, keep looking upward, via the
`:parent' property.  Useful to e.g. find the path of the file of the currently
selected tags or extension entry.  Must be called from treemacs buffer."
  (let ((path (treemacs-button-get btn :path)))
    (if (stringp path)
        path
      (-some-> (treemacs-button-get btn :parent)
               (treemacs--nearest-path)))))