From 748db4a4ee2f2e474f6a295cd417c65e3c5ad88a Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 22 Jun 2023 16:36:26 -0700 Subject: [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. --- oni-notmuch.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 ;; 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) -- cgit v1.2.3-54-g00ecf