From d7824cacb2bb9d0b9c15fa24e15ac367effec9a5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 20 Jan 2023 13:14:55 -0600 Subject: meh --- lisp/acdw-mail.el | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lisp/acdw-mail.el') diff --git a/lisp/acdw-mail.el b/lisp/acdw-mail.el index 8b0ab25..ae78fa0 100644 --- a/lisp/acdw-mail.el +++ b/lisp/acdw-mail.el @@ -74,6 +74,7 @@ for a free-form search. With any other PREFIX argument, open (mapcar (lambda (elt) (plist-get elt :name)) notmuch-saved-searches)) + notmuch-saved-searches :key (lambda (elt) (plist-get elt :name)) :test #'equal) :query))) @@ -127,6 +128,22 @@ the saved search as well." (equal (plist-get a :name) (plist-get b :name)))))) +(defun notmuch-async-poll () + "Run `notmuch-poll' in an async process." + (interactive) + (if (require 'async nil t) + (progn + (message "Polling mail async...") + (async-start + (lambda () + (push "~/usr/share/emacs/site-lisp/" load-path) + (require 'notmuch-lib) + (notmuch-poll)) + (lambda (result) + (message "%s" result)))) + (user-error "Feature `async' not found!"))) + + ;;; Packages (use-package bbdb @@ -174,7 +191,9 @@ the saved search as well." mail-specify-envelope-from t message-sendmail-envelope-from 'header message-envelope-from 'header - notmuch-saved-searches nil) + notmuch-saved-searches nil + notmuch-poll-script "~/usr/scripts/syncmail" ; XXX: Deprecated option + ) ;; Key bindings (keymap-set notmuch-search-mode-map "!" #'+notmuch-search-mark-spam) (keymap-set notmuch-search-mode-map "RET" #'notmuch-search-show-thread) @@ -205,6 +224,9 @@ the saved search as well." (add-hook 'notmuch-message-mode-hook #'visual-fill-column-mode) (add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode) + (define-advice notmuch-bury-or-kill-this-buffer (:after (&rest _) poll-async) + (notmuch-async-poll)) + (define-advice notmuch-address-selection-function (:override (prompt collection _) no-initial-input) "Call `completing-read' with `notmuch-address-history'. -- cgit 1.4.1-21-gabe81