[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:
parent
af7cce50e8
commit
748db4a4ee
1 changed files with 13 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2023.0621.223804
|
;; Version: 2023.0622.163614
|
||||||
;; Package-Requires: (oni-sendmail notmuch ol-notmuch)
|
;; Package-Requires: (oni-sendmail notmuch ol-notmuch)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; 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-archive-thread reverse begin end)
|
||||||
(notmuch-search-tag (notmuch-tag-change-list '("deleted") 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
|
(add-to-list 'notmuch-search-line-faces
|
||||||
'("@me" . (:foreground "#90ca82")))
|
'("@me" . (:foreground "#90ca82")))
|
||||||
(add-to-list 'notmuch-search-line-faces
|
(add-to-list 'notmuch-search-line-faces
|
||||||
'("deleted" . (:foreground "#3f4242")))
|
'("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)
|
(define-key notmuch-search-mode-map (kbd "d") #'oni-notmuch-search-delete-thread)
|
||||||
|
|
||||||
(provide 'oni-notmuch)
|
(provide 'oni-notmuch)
|
||||||
|
|
Loading…
Reference in a new issue