From e3761f1ceecd73075adafbf2467824b6be5d6dcd Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 8 Feb 2016 08:44:05 +0200 Subject: [PATCH] Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. --- da/8eae0dc915cfdfcde6add1b952a6cfac065727 | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 da/8eae0dc915cfdfcde6add1b952a6cfac065727 diff --git a/da/8eae0dc915cfdfcde6add1b952a6cfac065727 b/da/8eae0dc915cfdfcde6add1b952a6cfac065727 new file mode 100644 index 000000000..a4fb03fcb --- /dev/null +++ b/da/8eae0dc915cfdfcde6add1b952a6cfac065727 @@ -0,0 +1,114 @@ +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 01AFA6DE0A7F + for ; Sun, 7 Feb 2016 22:44:02 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.646 +X-Spam-Level: +X-Spam-Status: No, score=0.646 tagged_above=-999 required=5 tests=[AWL=-0.006, + SPF_NEUTRAL=0.652] 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 eJtjkV0G3Iry for ; + Sun, 7 Feb 2016 22:44:00 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by arlo.cworth.org (Postfix) with ESMTP id B0AA56DE0261 + for ; Sun, 7 Feb 2016 22:43:59 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 215A510007F; + Mon, 8 Feb 2016 08:44:06 +0200 (EET) +From: Tomi Ollila +To: Mark Walters , David Edmondson , + notmuch@notmuchmail.org +Subject: Re: [PATCH v1] emacs: Report a lack of matches when calling + `notmuch-show'. +In-Reply-To: <871t8onmnb.fsf@qmul.ac.uk> +References: <1454782892-1690-1-git-send-email-dme@dme.org> + <1454782892-1690-2-git-send-email-dme@dme.org> <871t8onmnb.fsf@qmul.ac.uk> +User-Agent: Notmuch/0.21+32~g73439f8 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +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: Mon, 08 Feb 2016 06:44:02 -0000 + +On Mon, Feb 08 2016, Mark Walters wrote: + +> 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). + +Actually I got the same when testing + +(notmuch-show "id:nonexistent") M-x eval-print-last-sexp + +instead of M-x eval-last-sexp + +(C-j in lisp-interaction buffer, instead of c-x c-e) + +... I agree that if we handle the situation, perhaps throwing an +error is not the best way... + +> [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 -- 2.26.2