* mu4e: add variable mu4e-hide-index-messages

This commit is contained in:
djcb 2013-08-11 14:37:19 +03:00
parent f7eefcf37a
commit beffb8072b
3 changed files with 22 additions and 11 deletions

View File

@ -193,6 +193,13 @@ echo area, don't show anything."
(unless (or (active-minibuffer-window)) (unless (or (active-minibuffer-window))
(message "%s" (apply 'mu4e-format frm args)))) (message "%s" (apply 'mu4e-format frm args))))
(defun mu4e-index-message (frm &rest args)
"Like `mu4e-message', but specifically for
index-messages. Doesn't display anything if
`mu4e-hide-index-messages' is non-nil. "
(unless mu4e-hide-index-messages
(apply 'mu4e-message frm args)))
(defun mu4e-error (frm &rest args) (defun mu4e-error (frm &rest args)
"Create [mu4e]-prefixed error based on format FRM and ARGS. "Create [mu4e]-prefixed error based on format FRM and ARGS.
Does a local-exit and does not return, and raises a Does a local-exit and does not return, and raises a
@ -538,21 +545,21 @@ process."
((eq type 'add) t) ;; do nothing ((eq type 'add) t) ;; do nothing
((eq type 'index) ((eq type 'index)
(if (eq (plist-get info :status) 'running) (if (eq (plist-get info :status) 'running)
(mu4e-message "Indexing... processed %d, updated %d" (mu4e-index-message "Indexing... processed %d, updated %d"
(plist-get info :processed) (plist-get info :updated)) (plist-get info :processed) (plist-get info :updated))
(progn (progn
(mu4e-message (mu4e-index-message
"Indexing completed; processed %d, updated %d, cleaned-up %d" "Indexing completed; processed %d, updated %d, cleaned-up %d"
(plist-get info :processed) (plist-get info :updated) (plist-get info :processed) (plist-get info :updated)
(plist-get info :cleaned-up)) (plist-get info :cleaned-up))
(unless (zerop (plist-get info :updated)) (unless (zerop (plist-get info :updated))
(run-hooks 'mu4e-index-updated-hook))))) (run-hooks 'mu4e-index-updated-hook)))))
((plist-get info :message) ((plist-get info :message)
(mu4e-message "%s" (plist-get info :message)))))) (mu4e-index-message "%s" (plist-get info :message))))))
(defun mu4e-error-handler (errcode errmsg) (defun mu4e-error-handler (errcode errmsg)
"Handler function for showing an error." "Handler function for showing an error."
;; don't use mu4e-error here; it's running in the process filter ctx ;; don't use mu4e-error here; it's running in the process filter context
(case errcode (case errcode
(4 (user-error "No matches for this search query.")) (4 (user-error "No matches for this search query."))
(t (error "Error %d: %s" errcode errmsg)))) (t (error "Error %d: %s" errcode errmsg))))
@ -630,7 +637,7 @@ This is used by the completion function in mu4e-compose."
(add-to-list 'lst (add-to-list 'lst
(if name (format "%s <%s>" (mu4e~rfc822-quoteit name) mail) mail)))))) (if name (format "%s <%s>" (mu4e~rfc822-quoteit name) mail) mail))))))
(setq mu4e~contacts-for-completion lst) (setq mu4e~contacts-for-completion lst)
(mu4e-message "Contacts received: %d" (mu4e-index-message "Contacts received: %d"
(length mu4e~contacts-for-completion)))) (length mu4e~contacts-for-completion))))
@ -792,9 +799,8 @@ The messages are inserted into the process buffer."
;; - (optionally) check password requests ;; - (optionally) check password requests
(defun mu4e-update-mail-and-index (run-in-background) (defun mu4e-update-mail-and-index (run-in-background)
"Get a new mail by running `mu4e-get-mail-command'. If "Get a new mail by running `mu4e-get-mail-command'. If
run-in-background is non-nil (or functional called with run-in-background is non-nil (or called with prefix-argument), run
prefix-argument), run in the background; otherwise, pop up a in the background; otherwise, pop up a window."
window."
(interactive "P") (interactive "P")
(unless mu4e-get-mail-command (unless mu4e-get-mail-command
(mu4e-error "`mu4e-get-mail-command' is not defined")) (mu4e-error "`mu4e-get-mail-command' is not defined"))
@ -805,7 +811,7 @@ window."
(process-connection-type t) (process-connection-type t)
(proc (start-process-shell-command (proc (start-process-shell-command
mu4e~update-name buf mu4e-get-mail-command))) mu4e~update-name buf mu4e-get-mail-command)))
(mu4e-message "Retrieving mail...") (mu4e-index-message "Retrieving mail...")
(when (window-live-p win) (when (window-live-p win)
(with-selected-window win (with-selected-window win
(switch-to-buffer buf) (switch-to-buffer buf)

View File

@ -78,6 +78,9 @@ mu4e."
:group 'mu4e :group 'mu4e
:safe 'integerp) :safe 'integerp)
(defvar mu4e-hide-index-messages nil
"If non-nil, mu4e does not show the \"Indexing...\" messages, or
any messages relating to updated contacts.")
(defcustom mu4e-change-filenames-when-moving nil (defcustom mu4e-change-filenames-when-moving nil
"When moving messages to different folders, normally mu/mu4e keep "When moving messages to different folders, normally mu/mu4e keep
@ -125,8 +128,7 @@ personal message. This is used when indexing messages."
`format-time-string'." `format-time-string'."
:type 'string :type 'string
:group 'mu4e) :group 'mu4e)
(defvar mu4e-debug nil (defvar mu4e-debug nil
"When set to non-nil, log debug information to the *mu4e-log* buffer.") "When set to non-nil, log debug information to the *mu4e-log* buffer.")

View File

@ -2910,6 +2910,9 @@ another @command{mu} instance that is holding the lock, you can ask it to
@end verbatim @end verbatim
@t{mu4e} automatically restarts @t{mu} when it needs it. In practice, this @t{mu4e} automatically restarts @t{mu} when it needs it. In practice, this
seems to work quite well. seems to work quite well.
@item @emph{I don't like the @t{Indexing...} messages that the indexing process
gives me. Can I turn them off?}. Yes: set the variable
@code{mu4e-hide-index-messages} to non-@t{nil}.
@item @emph{Can I automatically apply the marks on messages when @item @emph{Can I automatically apply the marks on messages when
leaving the headers buffer?} Yes you can -- see the documentation for the leaving the headers buffer?} Yes you can -- see the documentation for the
variable @t{mu4e-headers-leave-behavior}. variable @t{mu4e-headers-leave-behavior}.