mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Fix #47: new style buffer-name
, which respects uniquify names.
This commit is contained in:
parent
364f5acb0b
commit
b91e76b383
2 changed files with 19 additions and 13 deletions
|
@ -73,7 +73,8 @@ Recommand to use [doom-themes](https://github.com/hlissner/emacs-doom-themes);
|
|||
;; truncate-all => ~/P/F/e/l/comint.el
|
||||
;; relative-from-project => emacs/lisp/comint.el
|
||||
;; relative-to-project => lisp/comint.el
|
||||
;; file-name => comint.el"
|
||||
;; file-name => comint.el
|
||||
;; buffer-name => comint.el<2> (uniquify buffer name)
|
||||
;;
|
||||
;; If you are expereicing the laggy issue, especially while editing remote files
|
||||
;; with tramp, please try `file-name' style.
|
||||
|
|
|
@ -86,7 +86,8 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
|
|||
truncate-all => ~/P/F/e/l/comint.el
|
||||
relative-from-project => emacs/lisp/comint.el
|
||||
relative-to-project => lisp/comint.el
|
||||
file-name => comint.el")
|
||||
file-name => comint.el
|
||||
buffer-name => comint.el<2> (uniquify buffer name)")
|
||||
|
||||
(defvar doom-modeline-python-executable "python"
|
||||
"What executable of Python will be used (if nil nothing will be showed).")
|
||||
|
@ -520,8 +521,11 @@ active.")
|
|||
(doom-modeline--buffer-file-name-relative buffer-file-name buffer-file-truename))
|
||||
(`relative-from-project
|
||||
(doom-modeline--buffer-file-name-relative buffer-file-name buffer-file-truename 'include-project))
|
||||
(`file-name
|
||||
(propertize (file-name-nondirectory buffer-file-name)
|
||||
(style
|
||||
(propertize
|
||||
(pcase style
|
||||
(`file-name (file-name-nondirectory buffer-file-name))
|
||||
(`buffer-name (buffer-name)))
|
||||
'face
|
||||
(let ((face (or (and (buffer-modified-p)
|
||||
'doom-modeline-buffer-modified)
|
||||
|
@ -644,7 +648,7 @@ buffer where knowing the current project directory is important."
|
|||
'face face))))
|
||||
|
||||
;;
|
||||
(defun doom-modeline-fixed-buffer-file-name ()
|
||||
(defun doom-modeline-fix-buffer-file-name ()
|
||||
"Fix buffer file name in mode-line.
|
||||
|
||||
Show buffer name if it doesn't equal the file name.
|
||||
|
@ -653,7 +657,8 @@ buffer where knowing the current project directory is important."
|
|||
(when-let ((file-name (doom-modeline-buffer-file-name))
|
||||
(buffer-name (buffer-name))
|
||||
(buffer-file-name buffer-file-name))
|
||||
(if (or (not (file-exists-p buffer-file-name))
|
||||
(if (or (eq doom-modeline-buffer-file-name-style 'buffer-name)
|
||||
(not (file-exists-p buffer-file-name))
|
||||
(string-equal
|
||||
(file-name-nondirectory buffer-file-name)
|
||||
(replace-regexp-in-string "<.+>$" "" buffer-name)))
|
||||
|
@ -692,7 +697,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
|||
:v-adjust -0.05)
|
||||
" "))))
|
||||
(if buffer-file-name
|
||||
(doom-modeline-fixed-buffer-file-name)
|
||||
(doom-modeline-fix-buffer-file-name)
|
||||
(propertize "%b" 'face (if active 'doom-modeline-buffer-file))))))
|
||||
|
||||
(doom-modeline-def-segment buffer-info-simple
|
||||
|
|
Loading…
Reference in a new issue