Fix #195: Invalid face reference in persp-name.

This commit is contained in:
Vincent Zhang 2019-07-16 00:39:05 +08:00
parent bdbf45e690
commit fc7cf85f1c

View file

@ -1332,34 +1332,31 @@ Requires `eyebrowse-mode' to be enabled."
(fboundp 'get-current-persp)) (fboundp 'get-current-persp))
(let* ((persp (get-current-persp)) (let* ((persp (get-current-persp))
(name (safe-persp-name persp)) (name (safe-persp-name persp))
(icon (if (and doom-modeline-icon doom-modeline-persp-name-icon)
(doom-modeline-icon-material "aspect_ratio" :v-adjust -0.225)
"#"))
(face (if (and persp (face (if (and persp
(not (persp-contain-buffer-p (current-buffer) persp))) (not (persp-contain-buffer-p (current-buffer) persp)))
'doom-modeline-persp-buffer-not-in-persp 'doom-modeline-persp-buffer-not-in-persp
'doom-modeline-persp-name))) 'doom-modeline-persp-name))
(icon (if (and doom-modeline-icon doom-modeline-persp-name-icon)
(doom-modeline-icon-material "aspect_ratio" :v-adjust -0.225 :face face)
(propertize "#" 'face face))))
(unless (string-equal persp-nil-name name) (unless (string-equal persp-nil-name name)
(concat (concat (doom-modeline-spc)
(doom-modeline-spc) icon
(propertize icon (doom-modeline-vspc)
'face `(:inherit ,(get-text-property 0 'face icon) (propertize name
:inherit ,face)) 'face face
(doom-modeline-vspc) 'help-echo "mouse-1: Switch perspective
(propertize name
'face face
'help-echo "mouse-1: Switch perspective
mouse-2: Show help for minor mode" mouse-2: Show help for minor mode"
'mouse-face 'mode-line-highlight 'mouse-face 'mode-line-highlight
'local-map (let ((map (make-sparse-keymap))) 'local-map (let ((map (make-sparse-keymap)))
(define-key map [mode-line mouse-1] (define-key map [mode-line mouse-1]
#'persp-switch) #'persp-switch)
(define-key map [mode-line mouse-2] (define-key map [mode-line mouse-2]
(lambda () (lambda ()
(interactive) (interactive)
(describe-function 'persp-mode))) (describe-function 'persp-mode)))
map)) map))
(doom-modeline-spc))))))) (doom-modeline-spc)))))))
(add-hook 'find-file-hook #'doom-modeline-update-persp-name) (add-hook 'find-file-hook #'doom-modeline-update-persp-name)
(add-hook 'persp-activated-functions #'doom-modeline-update-persp-name) (add-hook 'persp-activated-functions #'doom-modeline-update-persp-name)