   :init "%b"
   :faces t
   (if buffer-file-name
-      (funcall +modeline-buffer-path-function buffer-file-name)
+      (+modeline-build-path buffer-file-name)
     "%b"))
 
 (def-modeline-segment! +modeline-buffer-directory

                  concat (if (eq idx len) "\"};" "\",\n")))
        'xpm t :ascent 'center)))))

(defun +modeline-file-path (&optional path)
  (let ((buffer-file-name (or path buffer-file-name))
        (root (doom-project-root)))
    (cond ((null root)
           (propertize "%b" 'face 'doom-modeline-buffer-file))
          ((or (null buffer-file-name)
               (directory-name-p buffer-file-name))
           (propertize (abbreviate-file-name (or buffer-file-name default-directory))
                       'face 'doom-modeline-buffer-path))
          ((let* ((true-filename (file-truename buffer-file-name))
                  (relative-dirs (file-relative-name (file-name-directory true-filename)
                                                     root)))
             (if (equal "./" relative-dirs) (setq relative-dirs ""))
             (concat (propertize (concat (doom-project-name) "/")
                                 'face 'doom-modeline-buffer-project-root)
                     (propertize relative-dirs
                                 'face 'doom-modeline-buffer-path)
                     (propertize (file-name-nondirectory true-filename)
                                 'face 'doom-modeline-buffer-file)))))))

;; TODO Add shrink-path alternatives


;;

  "If non-nil, the bar is transparent, and only used to police the height of the
mode-line.")

(defvar +modeline-buffer-path-function #'+modeline-file-path-with-project
  "A function that returns, in list form, components of the buffer file name
display in the mode-line.

Each item should either be a string or a a cons cell whose CAR is the path
component and CDR is the name of a face.

Currently available functions:

+ `+modeline-file-path-with-project': project/src/lib/file.c
+ `+modeline-file-path-from-project': src/lib/file.c
+ `+modeline-file-path-truncated-with-project': project/s/l/file.c
+ `+modeline-file-path-truncated-upto-project': ~/w/project/src/lib/file.c
+ `+modeline-file-path-truncated-upto-project-root': ~/w/p/s/lib/file.c
+ `+modeline-file-path-truncated': ~/w/p/s/l/file.c
+ `+modeline-file-name': file.c")

;; Convenience aliases
(defvaralias 'mode-line-format-left '+modeline-format-left)
