From 749279bc173e26f6d981b60fb969d15fc79d813c Mon Sep 17 00:00:00 2001 From: TatriX Date: Thu, 27 Jun 2019 16:43:38 +0200 Subject: [PATCH] Fix global-mode-string handling Current implementation doesn't always work. For example if one uses mu4e: ``` (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display) ``` `global-mode-string` will have `((:eval mu4e-alert-mode-line))` as it's value. And it will result in error: ``` Error during redisplay: (eval (mood-line-segment-global-mode-string)) signaled (void-function :eval) [11 times] ``` This commit uses `format-mode-line` function to manually evaluate `global-mode-string` and append it's result to the mode line if any. --- mood-line.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mood-line.el b/mood-line.el index bb05baf..9e60cba 100644 --- a/mood-line.el +++ b/mood-line.el @@ -262,9 +262,9 @@ (defun mood-line-segment-global-mode-string () "Displays the current value of `global-mode-string' in the mode-line." - (when (not (string= (mapconcat 'concat (mapcar 'eval global-mode-string) "") "")) - (propertize "%M " - 'face 'mood-line-status-grayed-out))) + (let ((global (format-mode-line global-mode-string 'mood-line-status-grayed-out))) + (unless (string-empty-p global) + (concat global " ")))) (defun mood-line-segment-flycheck () "Displays color-coded flycheck information in the mode-line (if available)."