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.
This commit is contained in:
TatriX 2019-06-27 16:43:38 +02:00
parent 3560d8aafd
commit 749279bc17

View File

@ -262,9 +262,9 @@
(defun mood-line-segment-global-mode-string () (defun mood-line-segment-global-mode-string ()
"Displays the current value of `global-mode-string' in the mode-line." "Displays the current value of `global-mode-string' in the mode-line."
(when (not (string= (mapconcat 'concat (mapcar 'eval global-mode-string) "") "")) (let ((global (format-mode-line global-mode-string 'mood-line-status-grayed-out)))
(propertize "%M " (unless (string-empty-p global)
'face 'mood-line-status-grayed-out))) (concat global " "))))
(defun mood-line-segment-flycheck () (defun mood-line-segment-flycheck ()
"Displays color-coded flycheck information in the mode-line (if available)." "Displays color-coded flycheck information in the mode-line (if available)."