X-Git-Url: https://git.cworth.org/git?p=obsolete%2Fnotmuch-wiki;a=blobdiff_plain;f=emacstips.mdwn;h=e63ab3137f9d45fc2a3802bc043523392050fb13;hp=311de7101ad08597809bfe30e82ca8fe5b263f2a;hb=cc2a074c714f142a1ea6f62583d111575fb95995;hpb=5654fb7a450477fbbe562d55dca2de2c94ab6a41 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)