From c005e07420d177e8d7be6c30939e5e1fa68bc2b8 Mon Sep 17 00:00:00 2001 From: Youmu Date: Sat, 6 Aug 2022 19:57:42 +0800 Subject: [PATCH] Revert "mu4e: update mu4e-main Maildirs section" This reverts commit 072731a5f5cbb57b5f6c32a89321199f70cbc9fa. --- modes/mu4e/evil-collection-mu4e.el | 63 ++---------------------------- 1 file changed, 4 insertions(+), 59 deletions(-) diff --git a/modes/mu4e/evil-collection-mu4e.el b/modes/mu4e/evil-collection-mu4e.el index b28ed0f..0fba0d8 100644 --- a/modes/mu4e/evil-collection-mu4e.el +++ b/modes/mu4e/evil-collection-mu4e.el @@ -70,11 +70,6 @@ (declare-function mu4e--main-action-str "mu4e-main") (declare-function mu4e--main-view-queue "mu4e-main") -(declare-function mu4e--longest-of-maildirs-and-bookmarks "mu4e-main") -(declare-function mu4e--longest-of-maildirs-and-bookmarks "mu4e-main") -(declare-function mu4e--maildirs-with-query "mu4e-folders") -(defvar mu4e--server-props) -(defvar mu4e-main-hide-fully-read) (defun evil-collection-mu4e--main-action-str (&rest args) "Wrapper for `mu4e--main-action-str' to maintain compatibility @@ -311,7 +306,7 @@ with older release versions of `mu4e.'" (concat (evil-collection-mu4e--main-action-str "\t* [;]Switch focus\n" 'mu4e-context-switch) (evil-collection-mu4e--main-action-str "\t* [u]pdate email & database (Alternatively: gr)\n" - 'mu4e-update-mail-and-index) + 'mu4e-update-mail-and-index) ;; show the queue functions if `smtpmail-queue-dir' is defined (if (file-directory-p smtpmail-queue-dir) @@ -324,53 +319,6 @@ with older release versions of `mu4e.'" (evil-collection-mu4e--main-action-str "\t* [H]elp\n" 'mu4e-display-manual) (evil-collection-mu4e--main-action-str "\t* [q]uit\n" 'mu4e-quit))) -(defvar evil-collection-mu4e-begin-region-maildir "\n Maildirs" - "The place where to end overriding Maildirs section.") - -(defvar evil-collection-mu4e-end-region-maildir "\t* \\[j.\\].*\n\n" - "The place where to end overriding Maildirs section.") - -(defun evil-collection-mu4e-new-region-maildir () - "Define the evil-mu4e Maildirs region." - (concat - ;; minorly edited version of mu4e--main-bookmarks mu4e-main.el - (cl-loop with mds = (mu4e--maildirs-with-query) - with longest = (mu4e--longest-of-maildirs-and-bookmarks) - with queries = (plist-get mu4e--server-props :queries) - for m in mds - for key = (string (plist-get m :key)) - for name = (plist-get m :name) - for query = (plist-get m :query) - for qcounts = (and (stringp query) - (cl-loop for q in queries - when (string= - (decode-coding-string - (plist-get q :query) - 'utf-8 t) - query) - collect q)) - for unread = (and qcounts (plist-get (car qcounts) :unread)) - when (not (plist-get m :hide)) - when (not (and mu4e-main-hide-fully-read (eq unread 0))) - concat (concat - ;; menu entry - (evil-collection-mu4e--main-action-str - (concat "\t* [J" key "] " name) - (concat "J" key)) - ;; append all/unread numbers, if available. - (if qcounts - (let ((unread (plist-get (car qcounts) :unread)) - (count (plist-get (car qcounts) :count))) - (format - "%s (%s/%s)" - (make-string (- longest (string-width name)) ? ) - (propertize (number-to-string unread) - 'face 'mu4e-header-key-face) - count)) - "") - "\n")) - "\n")) - (defun evil-collection-mu4e-replace-region (new-region start end) "Replace region between START and END with NEW-REGION. START end END end are regular expressions." @@ -387,17 +335,14 @@ START end END end are regular expressions." (delete-region start-point end-point))) (defun evil-collection-mu4e-update-main-view () - "Update 'Basic', 'Maildir', and 'Misc' regions to reflect -the new keybindings." + "Update 'Basic' and 'Misc' regions to reflect the new +keybindings." (evil-collection-mu4e-replace-region evil-collection-mu4e-new-region-basic evil-collection-mu4e-begin-region-basic evil-collection-mu4e-end-region-basic) (evil-collection-mu4e-replace-region (evil-collection-mu4e-new-region-misc) evil-collection-mu4e-begin-region-misc - evil-collection-mu4e-end-region-misc) - (evil-collection-mu4e-replace-region (evil-collection-mu4e-new-region-maildir) - evil-collection-mu4e-begin-region-maildir - evil-collection-mu4e-end-region-maildir)) + evil-collection-mu4e-end-region-misc)) ;;; Initialize evil-collection-mu4e