unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jon Rubens <jon@lbl.gov>
To: Preston Miller Firestone <0x504d46@disroot.org>, notmuch@notmuchmail.org
Subject: Re: WIP: asynchronous notmuch-poll in emacs client
Date: Sat, 12 Aug 2023 10:02:27 -0700	[thread overview]
Message-ID: <m2o7jckxcs.fsf@jon-mbp.lan> (raw)
In-Reply-To: <87ee36obxb.fsf@disroot.org>

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

Preston Miller Firestone <0x504d46@disroot.org> writes:

> a. notmuch-start-notmuch warns the user about everything, while
> notmuch-call-notmuch-process only warns on errors.
I don’t see any errors using a nearly similar approach. This might be from more async support in emacs.

> b. notmuch-poll-and-refresh-this-buffer doesn't know that notmuch-poll
> is now asynchronous and so refreshes too early.
I adjusted your sentinel to handle the refresh.
Had to take the refresh call out of notmuch-poll.

> c. The call to notmuch-poll-script is still synchronous, but that's a
> WIP. 
That variable is deprecated now so probably not worth fixing?


modified   emacs/notmuch-lib.el
@@ -278,6 +278,7 @@ displays both values separately."

;;; Commands

+;;;###autoload
 (defun notmuch-poll ()
   "Run \"notmuch new\" or an external script to import mail.

@@ -289,8 +290,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 "*notmuch-sync*"
+ nil
+ (lambda (proc string)
+ (notmuch-refresh-this-buffer)
+ (message "Polling mail async...done")) "new")))

  (defun notmuch-bury-or-kill-this-buffer ()
    "Undisplay the current buffer.
@@ -467,7 +471,8 @@ of its command symbol."
   "Invoke `notmuch-poll' to import mail, then refresh the current buffer."
   (interactive)
   (notmuch-poll)
- (notmuch-refresh-this-buffer))
+ ;; (notmuch-refresh-this-buffer)
+ )

  (defun notmuch-refresh-all-buffers ()
    "Invoke `notmuch-refresh-this-buffer' on all notmuch major-mode buffers.


-- 
Jon Rubens

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



      parent reply	other threads:[~2023-08-13 12:18 UTC|newest]

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

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=m2o7jckxcs.fsf@jon-mbp.lan \
    --to=jon@lbl.gov \
    --cc=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).