Fix incorrect faces of "%" in global-mode-string.

See https://github.com/seagle0128/doom-modeline/issues/121#issuecomment-471335250.
This commit is contained in:
Vincent Zhang 2019-03-11 15:36:29 +07:00
parent 94c24ac375
commit dc83e6a4c3
2 changed files with 14 additions and 19 deletions

View file

@ -303,14 +303,15 @@ Example:
(rhs-forms (doom-modeline--prepare-segments rhs))) (rhs-forms (doom-modeline--prepare-segments rhs)))
(defalias sym (defalias sym
(lambda () (lambda ()
(let ((rhs-str (format-mode-line (cons "" rhs-forms))))
(list lhs-forms (list lhs-forms
(propertize (propertize
" " " "
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive) 'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive)
'display `((space :align-to (- (+ right right-fringe right-margin) 'display `((space :align-to (- (+ right right-fringe right-margin)
,(+ 1 (string-width rhs-str)))))) ,(+ 1 (string-width
rhs-str))) (format-mode-line
(cons "" rhs-forms))))))))
rhs-forms))
(concat "Modeline:\n" (concat "Modeline:\n"
(format " %s\n %s" (format " %s\n %s"
(prin1-to-string lhs) (prin1-to-string lhs)

View file

@ -467,12 +467,9 @@ mouse-1: Display minor modes menu"
'mouse-1 #'minions-minor-modes-menu)) 'mouse-1 #'minions-minor-modes-menu))
" ") " ")
(propertize (propertize
(concat (replace-regexp-in-string (regexp-quote "%") "%%"
(replace-regexp-in-string (regexp-quote "%") (format-mode-line '("" minor-mode-alist " "))
"%%%%"
(format-mode-line '("" minor-mode-alist))
t t) t t)
" ")
'face (if active 'face (if active
'doom-modeline-buffer-minor-mode 'doom-modeline-buffer-minor-mode
'mode-line-inactive)))))) 'mode-line-inactive))))))
@ -1284,10 +1281,7 @@ mouse-2: Show help for minor mode"
"Mode line construct for miscellaneous information. "Mode line construct for miscellaneous information.
By default, this shows the information specified by `global-mode-string'." By default, this shows the information specified by `global-mode-string'."
(if (doom-modeline--active) (if (doom-modeline--active)
(replace-regexp-in-string (regexp-quote "%") '("" mode-line-misc-info)))
"%%%%"
(format-mode-line mode-line-misc-info)
t t)))
;; ;;
@ -1767,7 +1761,7 @@ we don't want to remove that so we just return the original."
(if doom-modeline-icon (if doom-modeline-icon
(doom-modeline-icon-faicon "battery-empty" :v-adjust -0.0575) (doom-modeline-icon-faicon "battery-empty" :v-adjust -0.0575)
(propertize "!" 'face face))))) (propertize "!" 'face face)))))
(status (and percentage (concat percentage "%%%%"))) (status (and percentage (concat percentage "%%")))
(help-echo (if battery-echo-area-format (help-echo (if battery-echo-area-format
(battery-format battery-echo-area-format fancy-battery-last-status) (battery-format battery-echo-area-format fancy-battery-last-status)
"Battery status not available"))) "Battery status not available")))