1
0
Fork 0

[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.
This commit is contained in:
Tom Willemse 2023-06-22 16:36:26 -07:00
parent af7cce50e8
commit 748db4a4ee

View file

@ -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)