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

Mark Walters markwalters1009 at gmail.com
Wed Oct 28 11:28:39 PDT 2015


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.
---

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



 emacs/notmuch-lib.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 1c3a9fe..89c01a5 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -243,8 +243,9 @@ depending on the value of `notmuch-poll-script'."
   (interactive)
   (if (stringp notmuch-poll-script)
       (unless (string= notmuch-poll-script "")
-	(call-process notmuch-poll-script nil nil))
-    (call-process notmuch-command nil nil nil "new")))
+	(unless (equal (call-process notmuch-poll-script nil nil) 0)
+	  (error "Notmuch: poll script `%s' failed!" notmuch-poll-script)))
+    (notmuch-call-notmuch-process "new")))
 
 (defun notmuch-bury-or-kill-this-buffer ()
   "Undisplay the current buffer.
-- 
2.1.4



More information about the notmuch mailing list