Asynchronous notmuch-poll?

Subject: Asynchronous notmuch-poll?

Date: Fri, 03 Apr 2020 11:16:18 +0200

To: notmuch@notmuchmail.org

Cc:

From: Pierre Neidhardt


Hi!

I am wondering why notmuch-poll is synchronous.
I tried making it asynchronous this way:

--8<---------------cut here---------------start------------->8---
(defun notmuch-poll-async ()
  "Like `notmuch-poll' but asynchronous."
  (notmuch-start-notmuch
   "notmuch-new"
   nil
   (lambda (_proc change)
     (with-current-buffer (find-if (lambda (b)
                                     (with-current-buffer b
                                       (eq major-mode 'notmuch-search-mode)))
                                   (buffer-list))
       (notmuch-refresh-this-buffer))
     (message "notmuch-new: %s" change))
   "new"))
--8<---------------cut here---------------end--------------->8---

Seems to work alright.  Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
signature.asc (application/pgp-signature)
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: