From cc2a074c714f142a1ea6f62583d111575fb95995 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 30 Sep 2012 00:53:45 +0300 Subject: [PATCH] notmuch-hello refresh status message --- emacstips.mdwn | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/emacstips.mdwn b/emacstips.mdwn index 311de71..e63ab31 100644 --- a/emacstips.mdwn +++ b/emacstips.mdwn @@ -551,3 +551,31 @@ show mode. (interactive "sBounce To: ") (notmuch-show-view-raw-message) (message-resend address))) + +## `notmuch-hello` refresh status message + +Add the following to your `.emacs` to get a status message about the change in +the number of messages in the mail store when refreshing the `notmuch-hello` +buffer. + + (defvar notmuch-hello-refresh-count 0) + + (defun notmuch-hello-refresh-status-message () + (unless no-display + (let* ((new-count + (string-to-number + (car (process-lines notmuch-command "count")))) + (diff-count (- new-count notmuch-hello-refresh-count))) + (cond + ((= notmuch-hello-refresh-count 0) + (message "You have %s messages." + (notmuch-hello-nice-number new-count))) + ((> diff-count 0) + (message "You have %s more messages since last refresh." + (notmuch-hello-nice-number diff-count))) + ((< diff-count 0) + (message "You have %s fewer messages since last refresh." + (notmuch-hello-nice-number (- diff-count))))) + (setq notmuch-hello-refresh-count new-count)))) + + (add-hook 'notmuch-hello-refresh-hook 'notmuch-hello-refresh-status-message) -- 2.43.0