unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Asynchronous notmuch-poll?
@ 2020-04-03  9:16 Pierre Neidhardt
  0 siblings, 0 replies; only message in thread
From: Pierre Neidhardt @ 2020-04-03  9:16 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 803 bytes --]

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/

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-05 19:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03  9:16 Asynchronous notmuch-poll? Pierre Neidhardt

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).