aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2023-06-22 16:36:26 -0700
committerGravatar Tom Willemse2023-06-22 16:36:26 -0700
commit748db4a4ee2f2e474f6a295cd417c65e3c5ad88a (patch)
tree5d954056505cdb52b73fcf2b8c804f703a386eaf
parentaf7cce50e8f7800a9c431647c7d2bbad565d9ad3 (diff)
downloademacs-config-748db4a4ee2f2e474f6a295cd417c65e3c5ad88a.tar.gz
emacs-config-748db4a4ee2f2e474f6a295cd417c65e3c5ad88a.zip
[oni-notmuch] Insert an extra section with a button to sync email
This section is meant to come right after the first “hello” section. The hooks should be set up in pre-new and post-new to make sure that everything that needs to run before and after works as expected.
-rw-r--r--oni-notmuch.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/oni-notmuch.el b/oni-notmuch.el
index 110afac..a930469 100644
--- a/oni-notmuch.el
+++ b/oni-notmuch.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2023.0621.223804
+;; Version: 2023.0622.163614
;; Package-Requires: (oni-sendmail notmuch ol-notmuch)
;; This program is free software; you can redistribute it and/or modify
@@ -38,11 +38,23 @@ in which to mark thread."
(notmuch-search-archive-thread reverse begin end)
(notmuch-search-tag (notmuch-tag-change-list '("deleted") reverse) begin end))
+(defun oni-notmuch-hello-insert-notmuch-command ()
+ "Insert a button to run the notmuch command to synchronize mail."
+ (widget-insert "Sync email: ")
+ (widget-create 'push-button
+ :notify (lambda (&rest _)
+ (async-shell-command "notmuch new"))
+ "sync")
+ (widget-insert "\n"))
+
(add-to-list 'notmuch-search-line-faces
'("@me" . (:foreground "#90ca82")))
(add-to-list 'notmuch-search-line-faces
'("deleted" . (:foreground "#3f4242")))
+(setf (cdr notmuch-hello-sections)
+ (cons 'oni-notmuch-hello-insert-notmuch-command (cdr notmuch-hello-sections)))
+
(define-key notmuch-search-mode-map (kbd "d") #'oni-notmuch-search-delete-thread)
(provide 'oni-notmuch)