From 3440ce4c7ca2ec70b97cdd7f151039b8ddb2d898 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 23 Jan 2019 16:56:37 +0800 Subject: [PATCH] Revert "mu4e: add new segment that shows unread emails" --- doom-modeline-core.el | 3 --- doom-modeline-segments.el | 27 --------------------------- doom-modeline.el | 27 ++++----------------------- 3 files changed, 4 insertions(+), 53 deletions(-) diff --git a/doom-modeline-core.el b/doom-modeline-core.el index 33ab7e8..5b3967a 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -119,9 +119,6 @@ The icons may not be showed correctly in terminal and on Windows.") (defvar doom-modeline-version t "Whether display environment version or not.") -(defvar doom-modeline-mu4e t - "Whether display mu4e notifications or not. Requires `mu4e-alert' package.") - ;; ;; Custom faces diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index b54e4dc..818464e 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -69,7 +69,6 @@ (defvar text-scale-mode-amount) (defvar winum-auto-setup-mode-line) (defvar xah-fly-insert-state-q) -(defvar mu4e-alert-mode-line) (declare-function anzu--reset-status 'anzu) (declare-function anzu--where-is-here 'anzu) @@ -1494,32 +1493,6 @@ mouse-1: Toggle Debug on Quit" (eval `(pdf-view-current-page)) (pdf-cache-number-of-pages)))) - -;; -;; mu4e-alert notifications -;; - -(defun doom-modeline-mu4e-formatter (mail-count) - "Doom mode-line's `mu4e-alert' formatter. -MAIL-COUNT is the count of mails for which the string is to displayed" - (when (not (zerop mail-count)) - (concat - (propertize - (format "%s" mail-count) - 'display '(raise 0.09) - 'face '(:height 0.85) - 'help-echo (if (= mail-count 1) - "You have an unread email" - (format "You have %s unread emails" mail-count))) - - ;; add a little space for padding - (propertize " " 'display '(space-width 0.6))))) - -(doom-modeline-def-segment mu4e - (when doom-modeline-mu4e - ;; this is the result of the mu4e formatter - mu4e-alert-mode-line)) - (provide 'doom-modeline-segments) ;;; doom-modeline-segments.el ends here diff --git a/doom-modeline.el b/doom-modeline.el index 96f80ea..6e2e439 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -83,7 +83,7 @@ (doom-modeline-def-modeline 'main '(bar workspace-number window-number evil-state god-state ryo-modal xah-fly-keys matches buffer-info remote-host buffer-position parrot selection-info) - '(misc-info persp-name lsp mu4e github debug minor-modes input-method buffer-encoding major-mode process vcs checker)) + '(misc-info persp-name lsp github debug minor-modes input-method buffer-encoding major-mode process vcs checker)) (doom-modeline-def-modeline 'minimal '(bar matches " " buffer-info) @@ -95,7 +95,7 @@ (doom-modeline-def-modeline 'project '(bar " " buffer-default-directory) - '(misc-info mu4e github debug " " major-mode " ")) + '(misc-info github debug " " major-mode " ")) (doom-modeline-def-modeline 'media '(bar window-number buffer-size buffer-info) @@ -147,23 +147,12 @@ If DEFAULT is non-nil, set the default mode-line for all buffers." "Set pdf mode-line." (doom-modeline-set-modeline 'pdf)) -;;;###autoload -(defun doom-modeline--remove-mu4e-alert-string () - "Remove the default `mu4e-alert' string. - -The string will conflict with our custom segment." - (setq global-mode-string (delete '(:eval mu4e-alert-mode-line) - global-mode-string))) - ;; ;; Mode ;; (defvar doom-modeline--default-mode-line mode-line-format) -(defvar mu4e-alert-modeline-formatter) -(declare-function mu4e-alert-default-mode-line-formatter 'mu4e-alert) -(declare-function mu4e-alert-enable-mode-line-display 'mu4e-alert) ;;;###autoload (define-minor-mode doom-modeline-mode @@ -185,10 +174,7 @@ The string will conflict with our custom segment." (add-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline) (add-hook 'image-mode-hook #'doom-modeline-set-media-modeline) (add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline) - (add-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline) - (setq mu4e-alert-modeline-formatter #'doom-modeline-mu4e-formatter) - (advice-add #'mu4e-alert-enable-mode-line-display - :after #'doom-modeline--remove-mu4e-alert-string)) + (add-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline)) (progn ;; Restore mode-line (setq-default mode-line-format doom-modeline--default-mode-line) @@ -196,12 +182,7 @@ The string will conflict with our custom segment." (remove-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline) (remove-hook 'image-mode-hook #'doom-modeline-set-media-modeline) (remove-hook 'circe-mode-hook #'doom-modeline-set-special-modeline) - (remove-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline) - ;; no harm in always restoring the defaults - (setq mu4e-alert-modeline-formatter - #'mu4e-alert-default-mode-line-formatter) - (advice-remove #'mu4e-alert-enable-mode-line-display - #'doom-modeline--remove-mu4e-alert-string)))) + (remove-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline)))) (provide 'doom-modeline)