Function: doom-modeline--project-root

doom-modeline--project-root is a natively compiled function defined in doom-modeline-core.el.

Signature

(doom-modeline--project-root)

Documentation

Get the path to the project root.

Return nil if no project was found.

Source Code

;; Defined in /nix/store/1lcicrdd2r4b8rkc91nnn74ymk1jl6yd-emacs-packages-deps/share/emacs/site-lisp/elpa/doom-modeline-20260928.1632/doom-modeline-core.el
(defun doom-modeline--project-root ()
  "Get the path to the project root.
Return nil if no project was found."
  (or doom-modeline--project-root
      (setq doom-modeline--project-root
            (cond
             ((and (memq doom-modeline-project-detection '(auto ffip))
                   (fboundp 'ffip-project-root))
              (let ((inhibit-message t))
                (ffip-project-root)))
             ((and (memq doom-modeline-project-detection '(auto projectile))
                   (bound-and-true-p projectile-mode))
              (projectile-project-root))
             ((and (memq doom-modeline-project-detection '(auto project))
                   (fboundp 'project-current))
              (when-let* ((project (project-current)))
                (expand-file-name
                 (if (fboundp 'project-root)
                     (project-root project)
                   (car (with-no-warnings
                          (project-roots project)))))))))))