unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Preston Miller Firestone <0x504d46@disroot.org>
To: notmuch@notmuchmail.org
Subject: WIP: asynchronous notmuch-poll in emacs client
Date: Sat, 12 Mar 2022 20:53:36 -0500	[thread overview]
Message-ID: <87ee36obxb.fsf@disroot.org> (raw)

In the emacs client, calls to (notmuch-poll) are sychronous, which means
that all of emacs hangs until notmuch new returns. I tried this little
patch to make it asynchronous, and it seems to work fine. Three
problems, though:

a. notmuch-start-notmuch warns the user about everything, while
notmuch-call-notmuch-process only warns on errors.
b. notmuch-poll-and-refresh-this-buffer doesn't know that notmuch-poll
is now asynchronous and so refreshes too early.
c. The call to notmuch-poll-script is still synchronous, but that's a
WIP. 

I think that the first two problems can be solved by a more
sophisticated sentinel than the one I'm using here, but I'd love to hear
other people's thoughts. Is there a reason that notmuch-poll is
synchronous? 

Here's a diff from notmuch-lib.el:

@@ -289,8 +289,11 @@ depending on the value of `notmuch-poll-script'."
       (unless (string-empty-p notmuch-poll-script)
 	(unless (equal (notmuch--call-process notmuch-poll-script nil nil) 0)
 	  (error "Notmuch: poll script `%s' failed!" notmuch-poll-script)))
-    (notmuch-call-notmuch-process "new"))
-  (message "Polling mail...done"))
+    (notmuch-start-notmuch "poll"
+			   nil
+			   (lambda (proc string)
+			     (message "Polling mail...done"))
+			   "new")))
 
 (defun notmuch-bury-or-kill-this-buffer ()
   "Undisplay the current buffer.

             reply	other threads:[~2022-03-13 13:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-13  1:53 Preston Miller Firestone [this message]
2022-03-19 11:06 ` WIP: asynchronous notmuch-poll in emacs client David Bremner
2023-08-12 17:02 ` Jon Rubens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee36obxb.fsf@disroot.org \
    --to=0x504d46@disroot.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).