aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Benencia <id@rbenencia.name>2023-01-12 07:34:41 -0800
committerRaul Benencia <id@rbenencia.name>2023-01-12 07:34:41 -0800
commit82bbdb507ad058353209e5963229caca2d4d7785 (patch)
tree7a791f79f27346b98e0ddb12b02129eb10ef07d0
parent2aa4d37e254d15bde83e01d5c5e83b0998509d98 (diff)
emacs: refresh notmuch after archiving
-rw-r--r--.emacs.local.d/modes/notmuch.el25
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)
nihil fit ex nihilo