modeline: fix name display in unnamed buffers

This commit is contained in:
Henrik Lissner 2016-10-05 12:50:36 +02:00
parent c9b69efa11
commit 01466fba55

View file

@ -129,7 +129,7 @@ cached the first time."
(defun doom-buffer-path () (defun doom-buffer-path ()
"Displays the buffer's full path relative to the project root (includes the "Displays the buffer's full path relative to the project root (includes the
project root). Excludes the file basename. See `doom-buffer-name' for that." project root). Excludes the file basename. See `doom-buffer-name' for that."
(when buffer-file-name (if buffer-file-name
(let* ((default-directory (f-dirname buffer-file-name)) (let* ((default-directory (f-dirname buffer-file-name))
(buffer-path (f-relative buffer-file-name (doom/project-root))) (buffer-path (f-relative buffer-file-name (doom/project-root)))
(max-length (truncate (* (window-body-width) 0.4)))) (max-length (truncate (* (window-body-width) 0.4))))
@ -147,7 +147,8 @@ project root). Excludes the file basename. See `doom-buffer-name' for that."
(when (string-suffix-p "/" output) (when (string-suffix-p "/" output)
(setq output (substring output 0 -1))) (setq output (substring output 0 -1)))
output) output)
buffer-path))))) buffer-path)))
"%b"))
;; ;;