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.
This commit is contained in:
Dirk-Jan C. Binnema 2020-04-06 20:49:39 +03:00
parent edd47ced71
commit abafd658d4
2 changed files with 28 additions and 8 deletions

View File

@ -7,7 +7,8 @@
- There's a new subcommand ~mu init~ to initialize the mu database, which - 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. 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 ~init~ only needs to be run once or when changing these parameters. That
implies that you need to re-index after changing these parameters. 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 passing ~--muhome=~/.mu~ to various ~mu~ commands, or setting ~(setq
mu4e-mu-home "~/.mu")~ for ~mu4e~. mu4e-mu-home "~/.mu")~ for ~mu4e~.
It is expected that the directory where the database lives survives a 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~. 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 After upgrading, you may wish to delete the files in the old location to
recover some diskspace. recover some diskspace.
@ -43,6 +45,11 @@
It is strongly recommended that you run ~mu init~ with the appropriate It is strongly recommended that you run ~mu init~ with the appropriate
parameters to (re)initialize the Xapian database. 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 - 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/ operation; this was slow for some users, so we have updated this to /only/
get the contacts that have changed since the last round. get the contacts that have changed since the last round.

View File

@ -32,6 +32,13 @@
;;; Mode ;;; 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*" (defvar mu4e-main-buffer-name " *mu4e-main*"
"Name of the mu4e main view buffer. The default name starts "Name of the mu4e main view buffer. The default name starts
with SPC and therefore is not visible in buffer list.") 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 () (defun mu4e~main-redraw-buffer ()
(with-current-buffer mu4e-main-buffer-name (with-current-buffer mu4e-main-buffer-name
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
(pos (point))) (pos (point))
(addrs (mu4e-personal-addresses)))
(erase-buffer) (erase-buffer)
(insert (insert
"* " "* "
@ -213,10 +221,15 @@ When REFRESH is non nil refresh infos from server."
(mu4e~key-val "maildir" (mu4e-root-maildir)) (mu4e~key-val "maildir" (mu4e-root-maildir))
(mu4e~key-val "in store" (mu4e~key-val "in store"
(format "%d" (plist-get mu4e~server-props :doccount)) "messages") (format "%d" (plist-get mu4e~server-props :doccount)) "messages")
;; (mu4e~key-val "personal addresses" (unless mu4e-main-buffer-hide-personal-addresses
;; (let ((addrs (mu4e-personal-addresses))) (mu4e~key-val "personal addresses" (if addrs (string-join addrs ", " ) "none"))))
;; (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) (mu4e-main-mode)
(goto-char pos)))) (goto-char pos))))