Function: doom-modeline--buffer-file-name-relative
doom-modeline--buffer-file-name-relative is a natively compiled
function defined in doom-modeline-core.el.
Signature
(doom-modeline--buffer-file-name-relative FILE-PATH TRUE-FILE-PATH &optional INCLUDE-PROJECT)
Documentation
Propertize file name showing directories relative to project's root only.
If INCLUDE-PROJECT is non-nil, the project path will be included.
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--buffer-file-name-relative (_file-path true-file-path &optional include-project)
"Propertize file name showing directories relative to project's root only.
If INCLUDE-PROJECT is non-nil, the project path will be included."
(let ((root (file-local-name (doom-modeline-project-root))))
(if (null root)
(propertize (buffer-name) 'face 'doom-modeline-buffer-file)
(let ((relative-dirs (file-relative-name (file-name-directory true-file-path)
(if include-project (concat root "../") root))))
(and (equal "./" relative-dirs) (setq relative-dirs ""))
(concat (propertize relative-dirs 'face 'doom-modeline-buffer-path)
(propertize (file-name-nondirectory true-file-path)
'face 'doom-modeline-buffer-file))))))