Fix nil face error and refactor icon faces.

This commit is contained in:
Vincent Zhang 2019-05-06 04:17:39 +08:00
parent 86142a68cf
commit 4795a3b3a8

View file

@ -377,12 +377,11 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(doom-modeline-update-buffer-file-icon)))) (doom-modeline-update-buffer-file-icon))))
(unless (string-empty-p icon) (unless (string-empty-p icon)
(concat (concat
(if (and active doom-modeline-major-mode-color-icon) (propertize icon 'face `(:inherit
icon ;; TODO: doom-modeline-major-mode-color-icon
(propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon) :inherit
:inherit ,(if active 'mode-line 'mode-line-inactive)))
,(if active 'mode-line 'mode-line-inactive))))
(if active doom-modeline-vspc doom-modeline-inactive-vspc))))) (if active doom-modeline-vspc doom-modeline-inactive-vspc)))))
;; state icon ;; state icon
@ -390,12 +389,10 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(doom-modeline-update-buffer-file-state-icon)))) (doom-modeline-update-buffer-file-state-icon))))
(unless (string-empty-p icon) (unless (string-empty-p icon)
(concat (concat
(if active (propertize icon 'face `(:inherit
icon ,(get-text-property 0 'face icon)
(propertize icon 'face `(:inherit :inherit
,(get-text-property 0 'face icon) ,(if active 'mode-line 'mode-line-inactive)))
:inherit
mode-line-inactive)))
(if active doom-modeline-vspc doom-modeline-inactive-vspc)))) (if active doom-modeline-vspc doom-modeline-inactive-vspc))))
;; buffer file name ;; buffer file name
@ -595,18 +592,16 @@ Uses `all-the-icons-octicon' to fetch the icon."
(text (or doom-modeline--vcs-text (doom-modeline-update-vcs-text)))) (text (or doom-modeline--vcs-text (doom-modeline-update-vcs-text))))
(concat (concat
(propertize " " 'face (if active 'mode-line 'mode-line-inactive)) (propertize " " 'face (if active 'mode-line 'mode-line-inactive))
(if active (propertize icon 'face `(:inherit
(concat icon ,(if doom-modeline-icon (get-text-property 0 'face icon))
(if doom-modeline-icon :inherit
doom-modeline-vspc) ,(if active 'mode-line 'mode-line-inactive)))
text) (if doom-modeline-icon
(concat (if active doom-modeline-vspc doom-modeline-inactive-vspc))
(propertize icon 'face `(:inherit (propertize text 'face `(:inherit
,(if doom-modeline-icon (get-text-property 0 'face icon)) ,(if doom-modeline-icon (get-text-property 0 'face text))
:inherit :inherit
mode-line-inactive)) ,(if active 'mode-line 'mode-line-inactive)))
doom-modeline-inactive-vspc
(propertize text 'face 'mode-line-inactive)))
(propertize " " 'face (if active 'mode-line 'mode-line-inactive)))))) (propertize " " 'face (if active 'mode-line 'mode-line-inactive))))))
@ -921,18 +916,18 @@ icons."
(concat (concat
(propertize (if vc-mode " " " ") (propertize (if vc-mode " " " ")
'face (if active 'mode-line 'mode-line-inactive)) 'face (if active 'mode-line 'mode-line-inactive))
(if active (when icon
(concat icon (propertize icon 'face `(:inherit
(when (and doom-modeline-icon icon text) doom-modeline-vspc) ,(if doom-modeline-icon (get-text-property 0 'face icon))
text) :inherit
(concat ,(if active 'mode-line 'mode-line-inactive))))
(when icon (when (and doom-modeline-icon icon text)
(propertize icon 'face `(:inherit (if active doom-modeline-vspc doom-modeline-inactive-vspc))
,(if doom-modeline-icon (get-text-property 0 'face icon)) (when text
:inherit (propertize text 'face `(:inherit
mode-line-inactive))) ,(if active
(when (and doom-modeline-icon icon text) doom-modeline-inactive-vspc) (get-text-property 0 'face text)
(when text (propertize text 'face 'mode-line-inactive)))) 'mode-line-inactive))))
" ")) " "))
""))) "")))
@ -2077,7 +2072,7 @@ we don't want to remove that so we just return the original."
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit
,(if doom-modeline-icon (get-text-property 0 'face icon)) ,(if doom-modeline-icon (get-text-property 0 'face icon))
:inherit :inherit
,(unless active 'mode-line-inactive)))))) ,(if active 'mode-line 'mode-line-inactive))))))
(when paradox-display-buffer-name (when paradox-display-buffer-name
(propertize (format " %%%sb" (length (buffer-name))) (propertize (format " %%%sb" (length (buffer-name)))