diff options
Diffstat (limited to '.emacs.local.d/modes')
-rw-r--r-- | .emacs.local.d/modes/notmuch.el | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/.emacs.local.d/modes/notmuch.el b/.emacs.local.d/modes/notmuch.el index b22ede3..42bdc45 100644 --- a/.emacs.local.d/modes/notmuch.el +++ b/.emacs.local.d/modes/notmuch.el @@ -61,13 +61,15 @@ (lambda () "archive" (interactive) - (notmuch-show-tag (list "+archive" "-inbox" "-unread")))) + (notmuch-show-tag (list "+archive" "-inbox" "-unread")) + (notmuch-refresh-this-buffer))) (define-key notmuch-search-mode-map "A" (lambda (&optional beg end) "mark thread as spam" (interactive (notmuch-search-interactive-region)) - (notmuch-search-tag (list "+archive" "-inbox" "-unread") beg end))) + (notmuch-search-tag (list "+archive" "-inbox" "-unread") beg end) + (notmuch-refresh-this-buffer))) ; Mark as read (define-key notmuch-search-mode-map "R" @@ -101,4 +103,23 @@ than one email. Use notmuch-show otherwise." (when overlay (overlay-put overlay 'face '((:inherit bold) (:foreground "green"))))))))))) +(defvar notmuch-hello-refresh-count 0) +(defun notmuch-hello-refresh-status-message () + (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 'color-inbox-if-unread) +(add-hook 'notmuch-hello-refresh-hook 'notmuch-hello-refresh-status-message) |