From cf9bfe34a53f5973a453bc2c64f6e1a40bcd8ff6 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sat, 3 Aug 2019 14:38:10 +0800 Subject: [PATCH] Fix #202: Be compatible with delight. --- doom-modeline-segments.el | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index b431a29..94f58d6 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -479,14 +479,16 @@ directory, the file name, and its state (modified, read-only or non-existent)." (propertize (concat (doom-modeline-spc) - (format-mode-line - `(:propertize ("" mode-name) - help-echo "Major mode\n\ + (propertize (format-mode-line + (or (and (boundp 'delighted-modes) + (cadr (assq major-mode delighted-modes))) + mode-name)) + 'help-echo "Major mode\n\ mouse-1: Display major mode menu\n\ mouse-2: Show help for major mode\n\ mouse-3: Toggle minor modes" - mouse-face mode-line-highlight - local-map ,mode-line-major-mode-keymap)) + 'mouse-face 'mode-line-highlight + 'local-map mode-line-major-mode-keymap) (when (and doom-modeline-env-version doom-modeline-env--version) (format " %s" doom-modeline-env--version)) (and (boundp 'text-scale-mode-amount) @@ -521,14 +523,14 @@ mouse-3: Toggle minor modes" (doom-modeline-def-segment minor-modes (when doom-modeline-minor-modes - (let ((active (doom-modeline--active))) + (let ((face (if (doom-modeline--active) + 'doom-modeline-buffer-minor-mode + 'mode-line-inactive))) (if (bound-and-true-p minions-mode) (concat (doom-modeline-spc) (propertize minions-mode-line-lighter - 'face (if active - 'doom-modeline-buffer-minor-mode - 'mode-line-inactive) + 'face face 'help-echo "Minions mouse-1: Display minor modes menu" 'mouse-face 'mode-line-highlight @@ -536,12 +538,12 @@ mouse-1: Display minor modes menu" 'mouse-1 #'minions-minor-modes-menu)) (doom-modeline-spc)) (concat - (format-mode-line - `(:propertize ("" minor-mode-alist) - face ,(if active - 'doom-modeline-buffer-minor-mode - 'mode-line-inactive))) - (doom-modeline-vspc)))))) + (propertize (replace-regexp-in-string + (regexp-quote "%") "%%%%" + (format-mode-line minor-mode-alist) + t t) + 'face face) + (doom-modeline-spc)))))) ;;