Re: [PATCH] emacs: poll: return useful errors when poll fails.

Subject: Re: [PATCH] emacs: poll: return useful errors when poll fails.

Date: Wed, 28 Oct 2015 22:18:26 +0200

To: Mark Walters, notmuch@notmuchmail.org, ketil@malde.org

Cc:

From: Tomi Ollila


On Wed, Oct 28 2015, Mark Walters <markwalters1009@gmail.com> wrote:

> Previously poll called from emacs would fail silently. This makes it
> return a useful error message.
>
> In the non-deprecated case of notmuch new and appropriate hooks, it
> uses notmuch-call-notmuch-process which gives an error and
> additionally puts the stdout/stderr etc in the *Notmuch errors*
> buffer.
>
> In the deprecated case of a custom poll script it only returns an
> error message.
>
> Commit based on a bug report, and a potential fix, by Ketil Malde.
> ---

Looks good (to me) -- I investigated a bit how notmuch-call-notmuch-process
does things; it uses notmuch-check-exit-status which is not applicable 
here.

Mark said he doesn't use poll -- and I have rewritten my poll(*) so my
tests will be as lightweight as his. So we wait for Ketil's report
how this works :D

Tomi

(*) see at the end of this email

>
> This should fix the bug reported in the parent message -- we should
> definitely report error messages. It might be nice to output the
> stdout/stderr in the custom poll script case but since we don't have
> built in infrastructure for it it probably isn't worth it for a
> deprecated case.
>
> (Note I don't use poll, so this is not heavily tested)
>
> Best wishes
>
> Mark
>

For reference, if anyone gets ideas from this...

;; overwrite notmuch-poll defined in notmuch.el
(defun notmuch-poll ()
  (interactive)
  (save-window-excursion
    (let ((buffer (get-buffer-create "*my notmuch polls*")))
      (set-buffer buffer)
      (setq buffer-read-only nil)
      (goto-char (point-max))
      (pop-to-buffer buffer)
      (call-process "notmuch-log-output.sh" nil t t "new" "--verbose")
      (bury-buffer))) ;; <- b-b to put the buffer at the "bottom" of buffers
  (message "update finished"))


Thread: