mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 19:19:53 +00:00
Show temp buffer name correctly.
That means the buffer exists but the file doesn't.
This commit is contained in:
parent
44542191e6
commit
ef1ee6357c
1 changed files with 12 additions and 9 deletions
|
@ -616,14 +616,14 @@ buffer where knowing the current project directory is important."
|
||||||
;; Show buffer name if it doesn't equal the file name.
|
;; Show buffer name if it doesn't equal the file name.
|
||||||
;; NOTE: Format: "buffer-file-name[buffer-name]".
|
;; NOTE: Format: "buffer-file-name[buffer-name]".
|
||||||
;; Except the same buffer names in different directories.
|
;; Except the same buffer names in different directories.
|
||||||
(if buffer-file-name
|
(when-let ((file-name (doom-modeline-buffer-file-name))
|
||||||
(let ((file-name (doom-modeline-buffer-file-name)))
|
(buffer-name (buffer-name))
|
||||||
(if (string-equal
|
(buffer-file-name buffer-file-name))
|
||||||
(file-name-nondirectory buffer-file-name)
|
(if (string-equal
|
||||||
(replace-regexp-in-string "<.+>$" "" (or (buffer-name) "")))
|
(file-name-nondirectory buffer-file-name)
|
||||||
file-name
|
(replace-regexp-in-string "<.+>$" "" buffer-name))
|
||||||
(format "%s[%s]" file-name (buffer-name))))
|
file-name
|
||||||
"%b")))
|
(format "%s[%s]" file-name buffer-name)))))
|
||||||
(add-hook 'find-file-hook #'doom-modeline-update-buffer-file-name)
|
(add-hook 'find-file-hook #'doom-modeline-update-buffer-file-name)
|
||||||
(add-hook 'after-revert-hook #'doom-modeline-update-buffer-file-name)
|
(add-hook 'after-revert-hook #'doom-modeline-update-buffer-file-name)
|
||||||
(add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name)
|
(add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name)
|
||||||
|
@ -656,7 +656,10 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" ")))
|
" ")))
|
||||||
doom-modeline-buffer-file-name))
|
(if (and buffer-file-name
|
||||||
|
(file-exists-p buffer-file-name))
|
||||||
|
doom-modeline-buffer-file-name
|
||||||
|
"%b")))
|
||||||
|
|
||||||
(doom-modeline-def-segment buffer-info-simple
|
(doom-modeline-def-segment buffer-info-simple
|
||||||
"Display only the current buffer's name, but with fontification."
|
"Display only the current buffer's name, but with fontification."
|
||||||
|
|
Loading…
Reference in a new issue