From dc83e6a4c3be760c2c79abfcb7b9ff943827be86 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Mon, 11 Mar 2019 15:36:29 +0700 Subject: [PATCH] Fix incorrect faces of "%" in global-mode-string. See https://github.com/seagle0128/doom-modeline/issues/121#issuecomment-471335250. --- doom-modeline-core.el | 17 +++++++++-------- doom-modeline-segments.el | 16 +++++----------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/doom-modeline-core.el b/doom-modeline-core.el index bdc9162..300a7a2 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -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) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 0b8f632..792e002 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -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")))