From: Mark Walters Date: Sun, 7 Feb 2016 23:09:12 +0000 (+0000) Subject: Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=43f3342a04dcc06fdf0c72ffc3b61f792be991d7;p=notmuch-archives.git Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. --- diff --git a/31/b92d31b0554863b8f30bf85778c9c017c777f4 b/31/b92d31b0554863b8f30bf85778c9c017c777f4 new file mode 100644 index 000000000..d8ebb0e4a --- /dev/null +++ b/31/b92d31b0554863b8f30bf85778c9c017c777f4 @@ -0,0 +1,133 @@ +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 2F76F6DE171E + for ; Sun, 7 Feb 2016 15:09:19 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.201 +X-Spam-Level: +X-Spam-Status: No, score=-0.201 tagged_above=-999 required=5 tests=[AWL=0.369, + 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 1OEaIyzhBbCg for ; + Sun, 7 Feb 2016 15:09:16 -0800 (PST) +Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com + [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id 82A296DE0C4A for + ; Sun, 7 Feb 2016 15:09:16 -0800 (PST) +Received: by mail-wm0-f68.google.com with SMTP id r129so12940603wmr.0 + for ; Sun, 07 Feb 2016 15:09:16 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=b4VOYGeKDoYYI/9tsZZOX5J2jNnnKBiCnxtboJq1nxc=; + b=OFUziC/24AicE6FsxWciLdT6Yjh4qeg51K5zve+HNqJs3GlM2I0tr3EcHlPn+dnAuk + PVQ1e5sqvBhnA8pZlbCC4BkTlie6sj4HiS57prceJycV3kDiezEfM0Jxa1oDspA367mt + E+UW67j+fe/QjfLW2Pr0TO4NbjzERsSJHeFatxh9wtHk2tLv7TbuBUhhqf3J99gsd1hu + yM6wjmYHh5C/EMssutR/VCt7tr6RPwUKZ9pPQ9qMOfu58OOgmAeQn//AMvbLnIkLiSWL + boA2D0R32w1GwGZQV5GVP2mp3N2FPo9PzUho7aD/4HdRfhk6uN9mT518H5c021scSdIR + 03/A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=b4VOYGeKDoYYI/9tsZZOX5J2jNnnKBiCnxtboJq1nxc=; + b=cdCkQkPOmhMGSQY3X1nL4HWJhrT5hgWKM6dZg1PhZbCYB8KBvE7f0ygpIKcH8H9YDG + CsJXAzU10R5zdLEcE02zEipfaEcTAg+9dV2IraWrrGvKEs2eJaF9JHggroMQhMZQmI5V + J1wYkbhrFZrS1GG58Hi0xh/R+0maLyG/QpaU6n+JTyxEMmhtCjNaDI7ViPi9HXKjFxLP + eWcQ0SIT1f2Y6He45ppt3pZysrUd8Ad+4mz/hISq3y+SKrIxHEyag+ebbfU+1W2WMb7K + YJaKseKpDU2dj8JioL9FArLTGnD7itsWjpwGWt7udNIkMFBsMaGtm9orxooWrh7mQm9m + 80uw== +X-Gm-Message-State: + AG10YOSC7IT+gBOa7M3Ec+m0O8dB0Z2KYD93oPB7bgY9I7K0xDOiZ1VHYX+dQgBjcUDoaA== +X-Received: by 10.194.7.67 with SMTP id h3mr24080087wja.44.1454886554513; + Sun, 07 Feb 2016 15:09:14 -0800 (PST) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by smtp.gmail.com with ESMTPSA id kb5sm27012417wjc.22.2016.02.07.15.09.13 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 07 Feb 2016 15:09:13 -0800 (PST) +From: Mark Walters +To: David Edmondson , notmuch@notmuchmail.org +Subject: Re: [PATCH v1] emacs: Report a lack of matches when calling + `notmuch-show'. +In-Reply-To: <1454782892-1690-2-git-send-email-dme@dme.org> +References: <1454782892-1690-1-git-send-email-dme@dme.org> + <1454782892-1690-2-git-send-email-dme@dme.org> +User-Agent: Notmuch/0.18.1+485~gca076ce (http://notmuchmail.org) Emacs/24.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 07 Feb 2016 23:09:12 +0000 +Message-ID: <871t8onmnb.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain +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: Sun, 07 Feb 2016 23:09:19 -0000 + +On Sat, 06 Feb 2016, David Edmondson wrote: +> If the basic query passed to `notmuch-show' generates no results, +> throw an error and inform the user that no messages matched the query +> rather than displaying an empty buffer and showing an obscure error. + +Hi + +First this is a clear improvement on the current behaviour, an I am +happy with it as is. + +However, I wonder if we actually want an error at all in this case, +rather than just a "message". I think some people run with +debug-on-error enabled and it might be annoying in that case (though +clearly less annoying than the current situation). + +[If anyone cares the current error comes from the marking read code in +the post-command hook which assumes the buffer has a message] + +Best wishes + +Mark + + +> --- +> emacs/notmuch-show.el | 8 +++++++- +> 1 file changed, 7 insertions(+), 1 deletion(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 3345878..335992e 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1248,7 +1248,13 @@ function is used." +> (when (and (eq (buffer-size) 0) +> notmuch-show-query-context) +> (notmuch-show-insert-forest +> - (notmuch-query-get-threads (append cli-args basic-args))))) +> + (notmuch-query-get-threads (append cli-args basic-args)))) +> + +> + ;; If there are still no results, kill the buffer and throw an +> + ;; error. +> + (when (eq (buffer-size) 0) +> + (kill-buffer (current-buffer)) +> + (error "No messages matched the query."))) +> +> (jit-lock-register #'notmuch-show-buttonise-links) +> +> -- +> 2.1.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> https://notmuchmail.org/mailman/listinfo/notmuch