              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)))))
+  (let* ((base (buffer-base-buffer))
+         (icon (cond (buffer-read-only
+                      (all-the-icons-octicon
+                       "lock"
+                       :face 'doom-modeline-warning
+                       :v-adjust -0.05))
+                     ((buffer-modified-p base)
+                      (all-the-icons-faicon
+                       "floppy-o"
+                       :face 'doom-modeline-buffer-modified
+                       :v-adjust -0.05))
+                     ((and (buffer-file-name base)
+                           (not (file-exists-p (buffer-file-name base))))
+                      (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)))
    (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)
