From dc519ab6967304ab0444fe030ad34f82db4b12bb Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 28 Oct 2015 18:28:39 +0000 Subject: [PATCH] [PATCH] emacs: poll: return useful errors when poll fails. --- d5/488cbedbc244ce39f6d8e6c5dac33af9a6a9e0 | 113 ++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 d5/488cbedbc244ce39f6d8e6c5dac33af9a6a9e0 diff --git a/d5/488cbedbc244ce39f6d8e6c5dac33af9a6a9e0 b/d5/488cbedbc244ce39f6d8e6c5dac33af9a6a9e0 new file mode 100644 index 000000000..af05d91a9 --- /dev/null +++ b/d5/488cbedbc244ce39f6d8e6c5dac33af9a6a9e0 @@ -0,0 +1,113 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 0BE4A6DE17EE + for ; Wed, 28 Oct 2015 11:28:55 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.907 +X-Spam-Level: +X-Spam-Status: No, score=-0.907 tagged_above=-999 required=5 + tests=[AWL=-0.337, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, + DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id GnnHZlPOcndE for ; + Wed, 28 Oct 2015 11:28:53 -0700 (PDT) +Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com + [209.85.212.178]) + by arlo.cworth.org (Postfix) with ESMTPS id D1D726DE0C11 + for ; Wed, 28 Oct 2015 11:28:52 -0700 (PDT) +Received: by wijp11 with SMTP id p11so266187750wij.0 + for ; Wed, 28 Oct 2015 11:28:46 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=7CDeicInkt/bhzEFrlI2DDbqPn8Q4iCX7KncKQ8iPXk=; + b=DdARa3CnzezO/1/3tbcSrmacEP0EoVHuNdjv0UUriVfKZr6jKva2dnRgj5C75Yj0mW + TT5lnorf7S5S052eLrGkCMeqDXc/eScf35N96/mqWDkH1s0CmIRAk4o3BOIxoBAUKRdw + CbjLOy0wk5sfv4ocBOqjshPGmkKf5YO+CPdIZf28mtgp/OHFGo/xTL/dCKHtt4OncuBj + xuS+InAFi5BAhRdqoXZggdcRGk4i/D74lv6XalYrL/yR1XW39lPPzNoKGlmHvk3iIMqJ + S6XpGqUhHEBsGMixf5EwfKGr2WsSfHvf0q9gh4vQqlz6k495djPjoCc1TNcMFekRL6UQ + QhnA== +X-Received: by 10.194.122.42 with SMTP id lp10mr41035957wjb.51.1446056926162; + Wed, 28 Oct 2015 11:28:46 -0700 (PDT) +Received: from localhost (188.29.75.230.threembb.co.uk. [188.29.75.230]) + by smtp.gmail.com with ESMTPSA id p4sm1384840wif.22.2015.10.28.11.28.44 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Wed, 28 Oct 2015 11:28:45 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org, + ketil@malde.org +Subject: [PATCH] emacs: poll: return useful errors when poll fails. +Date: Wed, 28 Oct 2015 18:28:39 +0000 +Message-Id: <1446056919-27822-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <87bnd5qjnd.fsf@wespe.malde.org> +References: <87bnd5qjnd.fsf@wespe.malde.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 28 Oct 2015 18:28:55 -0000 + +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 + -- 2.26.2