Asynchronous notmuch-poll?

Pierre Neidhardt mail at ambrevar.xyz
Fri Apr 3 02:16:18 PDT 2020


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20200403/446e6f33/attachment-0001.sig>


More information about the notmuch mailing list