Fix #180: Error for TRAMP python in doom-modeline-env.

This commit is contained in:
Vincent Zhang 2019-05-31 22:04:16 +08:00
parent 97dba610f8
commit 59c81a0d81

View file

@ -542,15 +542,13 @@ If the actual char height is larger, it respects the actual char height.")
Return `default-directory' if no project was found." Return `default-directory' if no project was found."
(or doom-modeline-project-root (or doom-modeline-project-root
(setq doom-modeline-project-root (setq doom-modeline-project-root
(file-local-name (or (and (bound-and-true-p projectile-mode)
(or
(when (bound-and-true-p projectile-mode)
(ignore-errors (projectile-project-root))) (ignore-errors (projectile-project-root)))
(when (fboundp 'project-current) (and (fboundp 'project-current)
(ignore-errors (ignore-errors
(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))))) default-directory))))
(defun doom-modeline--make-xpm (face width height) (defun doom-modeline--make-xpm (face width height)
"Create an XPM bitmap via FACE, WIDTH and HEIGHT. Inspired by `powerline''s `pl/make-xpm'." "Create an XPM bitmap via FACE, WIDTH and HEIGHT. Inspired by `powerline''s `pl/make-xpm'."
@ -663,7 +661,7 @@ If TRUNCATE-TAIL is t also truncate the parent directory of the file."
(defun doom-modeline--buffer-file-name-relative (_file-path true-file-path &optional include-project) (defun doom-modeline--buffer-file-name-relative (_file-path true-file-path &optional include-project)
"Propertized variable `buffer-file-name' showing directories relative to project's root only." "Propertized variable `buffer-file-name' showing directories relative to project's root only."
(let ((root (doom-modeline-project-root)) (let ((root (file-local-name (doom-modeline-project-root)))
(active (doom-modeline--active))) (active (doom-modeline--active)))
(if (null root) (if (null root)
(propertize "%b" 'face (if active 'doom-modeline-buffer-file)) (propertize "%b" 'face (if active 'doom-modeline-buffer-file))
@ -695,7 +693,7 @@ If HIDE-PROJECT-ROOT-PARENT is non-nil will hide project root parent.
Example: Example:
~/Projects/FOSS/emacs/lisp/comint.el => emacs/lisp/comint.el" ~/Projects/FOSS/emacs/lisp/comint.el => emacs/lisp/comint.el"
(let ((project-root (doom-modeline-project-root)) (let ((project-root (file-local-name (doom-modeline-project-root)))
(active (doom-modeline--active)) (active (doom-modeline--active))
(modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified))) (modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
(let ((sp-faces (or modified-faces (if active 'doom-modeline-project-parent-dir))) (let ((sp-faces (or modified-faces (if active 'doom-modeline-project-parent-dir)))