Asynchronous notmuch-poll?

classic Classic list List threaded Threaded
1 message Options
Pierre Neidhardt Pierre Neidhardt
Reply | Threaded
Open this post in threaded view
|

Asynchronous notmuch-poll?

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/

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (497 bytes) Download Attachment