mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-24 03:00:10 +00:00
Fix: invalid path for remote files.
This commit is contained in:
parent
5c396e2e18
commit
364f5acb0b
1 changed files with 9 additions and 8 deletions
|
@ -344,7 +344,7 @@ active.")
|
||||||
(when (featurep 'project)
|
(when (featurep 'project)
|
||||||
(when-let ((project (project-current)))
|
(when-let ((project (project-current)))
|
||||||
(expand-file-name (car (project-roots project)))))
|
(expand-file-name (car (project-roots project)))))
|
||||||
default-directory))))
|
(file-local-name default-directory)))))
|
||||||
|
|
||||||
;; Disable projectile mode-line segment
|
;; Disable projectile mode-line segment
|
||||||
(setq projectile-dynamic-mode-line nil)
|
(setq projectile-dynamic-mode-line nil)
|
||||||
|
@ -500,9 +500,8 @@ active.")
|
||||||
|
|
||||||
(defun doom-modeline-buffer-file-name ()
|
(defun doom-modeline-buffer-file-name ()
|
||||||
"Propertized variable `buffer-file-name' based on `doom-modeline-buffer-file-name-style'."
|
"Propertized variable `buffer-file-name' based on `doom-modeline-buffer-file-name-style'."
|
||||||
(let ((buffer-file-name (or (buffer-file-name (buffer-base-buffer)) "")))
|
(let ((buffer-file-name (file-local-name (or (buffer-file-name (buffer-base-buffer)) "")))
|
||||||
(unless buffer-file-truename
|
(buffer-file-truename (file-local-name (or buffer-file-truename (file-truename buffer-file-name) ""))))
|
||||||
(setq buffer-file-truename (file-truename buffer-file-name)))
|
|
||||||
(propertize
|
(propertize
|
||||||
(pcase doom-modeline-buffer-file-name-style
|
(pcase doom-modeline-buffer-file-name-style
|
||||||
(`truncate-upto-project
|
(`truncate-upto-project
|
||||||
|
@ -602,7 +601,9 @@ Example:
|
||||||
(propertize
|
(propertize
|
||||||
(when-let (root-path-parent
|
(when-let (root-path-parent
|
||||||
(file-name-directory (directory-file-name project-root)))
|
(file-name-directory (directory-file-name project-root)))
|
||||||
(if truncate-project-root-parent
|
(if (and truncate-project-root-parent
|
||||||
|
(not (string-empty-p root-path-parent))
|
||||||
|
(not (string-equal root-path-parent "/")))
|
||||||
(shrink-path--dirs-internal root-path-parent t)
|
(shrink-path--dirs-internal root-path-parent t)
|
||||||
(abbreviate-file-name root-path-parent)))
|
(abbreviate-file-name root-path-parent)))
|
||||||
'face sp-props))
|
'face sp-props))
|
||||||
|
@ -643,8 +644,8 @@ buffer where knowing the current project directory is important."
|
||||||
'face face))))
|
'face face))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defun doom-modeline-update-buffer-file-name ()
|
(defun doom-modeline-fixed-buffer-file-name ()
|
||||||
"Update buffer file name in mode-line.
|
"Fix buffer file name in mode-line.
|
||||||
|
|
||||||
Show buffer name if it doesn't equal the file name.
|
Show buffer name if it doesn't equal the file name.
|
||||||
Format: \"buffer-file-name[buffer-name]\".
|
Format: \"buffer-file-name[buffer-name]\".
|
||||||
|
@ -691,7 +692,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))))
|
" "))))
|
||||||
(if buffer-file-name
|
(if buffer-file-name
|
||||||
(doom-modeline-update-buffer-file-name)
|
(doom-modeline-fixed-buffer-file-name)
|
||||||
(propertize "%b" 'face (if active 'doom-modeline-buffer-file))))))
|
(propertize "%b" 'face (if active 'doom-modeline-buffer-file))))))
|
||||||
|
|
||||||
(doom-modeline-def-segment buffer-info-simple
|
(doom-modeline-def-segment buffer-info-simple
|
||||||
|
|
Loading…
Reference in a new issue