 parent.
 
 e.g. project/src/lib/file.c"
-  (let ((filename (or buffer-file-truename (file-truename buffer-file-name))))
+  (let* ((base (buffer-base-buffer))
+         (filename (file-truename (buffer-file-name base))))
     (append (if (doom-project-p)
                 (let* ((project-root (doom-project-root))
                        (relative-dirs (file-relative-name (file-name-directory filename)

e.g. ~/w/p/s/l/file.c

Meant for `+modeline-buffer-path-function'."
  (pcase-let ((`(,dir . ,file) (shrink-path-prompt buffer-file-name)))
    (list (cons dir 'doom-modeline-buffer-path)
          (cons file 'doom-modeline-buffer-file))))


Meant for `+modeline-buffer-path-function'."
  (pcase-let
      ((`(,root-parent ,root ,dir, file)
        (let ((buffer-file-name (or buffer-file-name (buffer-file-name (buffer-base-buffer)))))
          (shrink-path-file-mixed (or (doom-project-root) default-directory)
                                  (file-name-directory buffer-file-name)
                                  buffer-file-name))))
    (list (cons root-parent 'font-lock-comment-face)
          (cons root 'doom-modeline-buffer-project-root)
          (cons (concat "/" dir) 'doom-modeline-buffer-path)
