From abafd658d49f0849b83d3c3fa51625a236c4c7a7 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 6 Apr 2020 20:49:39 +0300 Subject: [PATCH] mu4e: show mu4e-personal-addresses, add check Show the personal addresses in the main screen (allow hiding them with mu4e-main-view-hide-addresses), as well as a check for the case where user's user-email-address is not part of the personal addresses. --- NEWS.org | 13 ++++++++++--- mu4e/mu4e-main.el | 23 ++++++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/NEWS.org b/NEWS.org index 78c6b07c..5e9d937b 100644 --- a/NEWS.org +++ b/NEWS.org @@ -7,7 +7,8 @@ - There's a new subcommand ~mu init~ to initialize the mu database, which takes the ~--maildir~ and ~--my-address~ parameters that ~index~ used to take. - These parameters are persistent so ~index~ does not need them anymore. + These parameters are persistent so ~index~ does not need (or accept) them + anymore. ~mu4e~ now depends on those parameters. ~init~ only needs to be run once or when changing these parameters. That implies that you need to re-index after changing these parameters. @@ -25,8 +26,9 @@ passing ~--muhome=~/.mu~ to various ~mu~ commands, or setting ~(setq mu4e-mu-home "~/.mu")~ for ~mu4e~. - It is expected that the directory where the database lives survives a - reboot; if that is not true for the default, you can use ~--muhome~. + It is expected that the directory where the database lives, survives a + reboot; if that is not true in your case, you can use ~--muhome~ (otherwise + you'd have to reindex after each reboot). After upgrading, you may wish to delete the files in the old location to recover some diskspace. @@ -43,6 +45,11 @@ It is strongly recommended that you run ~mu init~ with the appropriate parameters to (re)initialize the Xapian database. + The main screen shows your address(es), and issues a warning if + ~user-email-address~ is not part of that (and refer you to ~mu init~). You can + avoid the addresses in the main screen and the warning by setting + ~mu4e-main-view-hide-addresses~ to non-nil. + - In many cases, ~mu4e~ used to receive /all/ contacts after each indexing operation; this was slow for some users, so we have updated this to /only/ get the contacts that have changed since the last round. diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index d0ce450e..43627a37 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -32,6 +32,13 @@ ;;; Mode +(defvar mu4e-main-buffer-hide-personal-addresses nil + "Whether to hid trhe personal address in the main view. This + can be useful to avoid the noise when there are many. + + This also hides the warning if your `user-mail-address' is not +part of the personal addresses.") + (defvar mu4e-main-buffer-name " *mu4e-main*" "Name of the mu4e main view buffer. The default name starts with SPC and therefore is not visible in buffer list.") @@ -171,7 +178,8 @@ When REFRESH is non nil refresh infos from server." (defun mu4e~main-redraw-buffer () (with-current-buffer mu4e-main-buffer-name (let ((inhibit-read-only t) - (pos (point))) + (pos (point)) + (addrs (mu4e-personal-addresses))) (erase-buffer) (insert "* " @@ -213,10 +221,15 @@ When REFRESH is non nil refresh infos from server." (mu4e~key-val "maildir" (mu4e-root-maildir)) (mu4e~key-val "in store" (format "%d" (plist-get mu4e~server-props :doccount)) "messages") - ;; (mu4e~key-val "personal addresses" - ;; (let ((addrs (mu4e-personal-addresses))) - ;; (if addrs(string-join addrs ", " ) "none"))) - ) + (unless mu4e-main-buffer-hide-personal-addresses + (mu4e~key-val "personal addresses" (if addrs (string-join addrs ", " ) "none")))) + + (unless mu4e-main-buffer-hide-personal-addresses + (when (and addrs user-mail-address (not (member user-mail-address addrs))) + (mu4e-message (concat + "Note: `user-mail-address' ('%s') is not part " + "of mu's addresses; add it with 'mu init --my-address='") + user-mail-address))) (mu4e-main-mode) (goto-char pos))))