 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)

             after-change-functions
             after-save-hook
             after-revert-hook)
  (let ((icon (cond (buffer-read-only
                     (all-the-icons-octicon
                      "lock"
                      :face 'doom-modeline-warning
                      :v-adjust -0.05))
                    ((buffer-modified-p)
                     (all-the-icons-faicon
                      "floppy-o"
                      :face 'doom-modeline-buffer-modified
                      :v-adjust -0.05))
                    ((and buffer-file-name (not (file-exists-p buffer-file-name)))
                     (all-the-icons-octicon
                      "circle-slash"
                      :face 'doom-modeline-urgent
                      :v-adjust -0.05)))))
    (if icon (concat icon " "))))

(def-modeline-segment! +modeline-buffer-id

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

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

