Function: doom-modeline--buffer-file-name-truncate
doom-modeline--buffer-file-name-truncate is a natively compiled
function defined in doom-modeline-core.el.
Signature
(doom-modeline--buffer-file-name-truncate FILE-PATH TRUE-FILE-PATH &optional TRUNCATE-TAIL)
Documentation
Propertize file name that truncates every dir along path.
If TRUNCATE-TAIL is t also truncate the parent directory of the file.
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-truncate (file-path true-file-path &optional truncate-tail)
"Propertize file name that truncates every dir along path.
If TRUNCATE-TAIL is t also truncate the parent directory of the file."
(let ((dirs (shrink-path-prompt (file-name-directory true-file-path))))
(if (null dirs)
(propertize (buffer-name) 'face 'doom-modeline-buffer-file)
(let ((dirname (car dirs))
(basename (cdr dirs)))
(concat (propertize (concat dirname
(if truncate-tail (substring basename 0 1) basename)
"/")
'face 'doom-modeline-project-root-dir)
(propertize (file-name-nondirectory file-path)
'face 'doom-modeline-buffer-file))))))