diff options
| author | Jani Nikula <jani@nikula.org> | 2012-09-30 00:53:45 +0300 |
|---|---|---|
| committer | Jani Nikula <jani@nikula.org> | 2012-09-30 00:53:45 +0300 |
| commit | cc2a074c714f142a1ea6f62583d111575fb95995 (patch) | |
| tree | 178575475272a3e9b35614855f373fefcc2154b8 | |
| parent | 5654fb7a450477fbbe562d55dca2de2c94ab6a41 (diff) | |
notmuch-hello refresh status message
| -rw-r--r-- | emacstips.mdwn | 28 |
1 files changed, 28 insertions, 0 deletions
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) |
