Function: treemacs--find-project-for-buffer

treemacs--find-project-for-buffer is a byte-compiled function defined in treemacs-workspaces.el.

Signature

(treemacs--find-project-for-buffer &optional BUFFER-FILE)

Documentation

In the current workspace find the project current buffer's file falls under.

Optionally supply the BUFFER-FILE in case it is not available by calling the function buffer-file-name(var)/buffer-file-name(fun) (like in Dired).

FILE: Filepath

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-workspaces.el
(define-inline treemacs--find-project-for-buffer (&optional buffer-file)
  "In the current workspace find the project current buffer's file falls under.
Optionally supply the BUFFER-FILE in case it is not available by calling the
function `buffer-file-name' (like in Dired).

FILE: Filepath"
  (inline-letevals (buffer-file)
    (inline-quote
     (progn
       (unless treemacs--project-of-buffer
         (let ((path (or ,buffer-file (buffer-file-name))))
           (when path (setf treemacs--project-of-buffer (treemacs-is-path path :in-workspace)))))
       treemacs--project-of-buffer))))