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)))
(defalias sym
(lambda ()
(let ((rhs-str (format-mode-line (cons "" rhs-forms))))
(list lhs-forms
(propertize
" "
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive)
'display `((space :align-to (- (+ right right-fringe right-margin)
,(+ 1 (string-width rhs-str))))))
rhs-str)))
(list lhs-forms
(propertize
" "
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive)
'display `((space :align-to (- (+ right right-fringe right-margin)
,(+ 1 (string-width
(format-mode-line
(cons "" rhs-forms))))))))
rhs-forms))
(concat "Modeline:\n"
(format " %s\n %s"
(prin1-to-string lhs)

View file

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