[PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'.
authorDavid Edmondson <dme@dme.org>
Sat, 6 Feb 2016 18:21:32 +0000 (18:21 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:59 +0000 (16:20 -0700)
e1/ee9d8f0eb69fb669c1c4fca6d61e041d37f112 [new file with mode: 0644]

diff --git a/e1/ee9d8f0eb69fb669c1c4fca6d61e041d37f112 b/e1/ee9d8f0eb69fb669c1c4fca6d61e041d37f112
new file mode 100644 (file)
index 0000000..a2598ae
--- /dev/null
@@ -0,0 +1,109 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A78866DE0B25\r
+ for <notmuch@notmuchmail.org>; Sat,  6 Feb 2016 10:21:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.236\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.236 tagged_above=-999 required=5 tests=[AWL=0.303, \r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652,\r
+ UNPARSEABLE_RELAY=0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id BJMpd_j_GA0r for <notmuch@notmuchmail.org>;\r
+ Sat,  6 Feb 2016 10:21:38 -0800 (PST)\r
+Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com\r
+ [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 64B866DE0A94 for\r
+ <notmuch@notmuchmail.org>; Sat,  6 Feb 2016 10:21:38 -0800 (PST)\r
+Received: by mail-wm0-f67.google.com with SMTP id 128so8335572wmz.3\r
+ for <notmuch@notmuchmail.org>; Sat, 06 Feb 2016 10:21:38 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=dme-org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:subject:date:message-id:in-reply-to:references;\r
+ bh=Yb6ETgawWwG2FbeJG26fdWUxoJKClL7JtLup7c6ytrg=;\r
+ b=UxLAe2KCyeT6t4GDXcqTS2FBYQnnBbtwWogcpY2FRoizaZo4vUux0j2fQcRq5sJg8+\r
+ lpweUxL3bYRLoxHWGjof1vO4uHhdqLEMRBa0IpFZuzyPeA9hT7Ved0RznFmhZd9MExfY\r
+ rZu0R46TUKUV+PLhxHK4NOOEGg1IlN+CsApO7nPK5gPV9MMcfHeE1hWhvJW7F/XJbzFX\r
+ 9zKLxsHEPgzvymTo8rB1+BKb6Eo5fP+xLv4shhLDYXT4m4pJvBlRj+wi7wj4t4MozDrz\r
+ 8v5Q0nu+oqR8eEHEejjYVsVD5OBqbCSzEkIRcCVxynD+e6IpH4Lg7jql4HfIqZJ+hMlP\r
+ dKJA==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=Yb6ETgawWwG2FbeJG26fdWUxoJKClL7JtLup7c6ytrg=;\r
+ b=TnKoubYP2Y5nx6aZlHVmnXiwvKoWaoATK4z7kSYlFJ+IYeP9NWfaYGq8tMsI6NniAE\r
+ wO1njc2Q+Nq1WnIWEAPVX8Av0csQEAdxLIoFDtTr8DIsrOUmci88MWz/UGSCq1gNoNyf\r
+ BMONPaWGO3fg7Ve2jCZddc43aQGH7mr869fRmbT+RjmnErzMcJw+m1cANNcKAj6t5+t4\r
+ Y0L/pmg0gVO3yOVXPbnJnzPOW90DPVtSu4ToXMF+sBRE34FSqXiGyo3z+rtezPFqjeXU\r
+ 9/Nq/oIZR47VvfLs5BHGWQ7kxSI2m+hNzGweOlYCDrDY/gF7utTfeq3DWSqtDIzb5Ivp\r
+ KPGQ==\r
+X-Gm-Message-State:\r
+ AG10YOR6JnVEmtFfToCqM6F84wEY4lI35Q/0q5hZ7jhYovdDfqQHAuM0JzHMVRLMHSkL4g==\r
+X-Received: by 10.194.95.70 with SMTP id di6mr22487138wjb.2.1454782897077;\r
+ Sat, 06 Feb 2016 10:21:37 -0800 (PST)\r
+Received: from disaster-area.hh.sledj.net\r
+ ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+ by smtp.gmail.com with ESMTPSA id e19sm1232744wmd.1.2016.02.06.10.21.35\r
+ for <notmuch@notmuchmail.org>\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 06 Feb 2016 10:21:35 -0800 (PST)\r
+Received: from localhost (disaster-area.hh.sledj.net [local])\r
+ by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 25260799\r
+ for <notmuch@notmuchmail.org>; Sat, 6 Feb 2016 18:21:32 +0000 (UTC)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v1] emacs: Report a lack of matches when calling\r
+ `notmuch-show'.\r
+Date: Sat,  6 Feb 2016 18:21:32 +0000\r
+Message-Id: <1454782892-1690-2-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1454782892-1690-1-git-send-email-dme@dme.org>\r
+References: <1454782892-1690-1-git-send-email-dme@dme.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 06 Feb 2016 18:21:40 -0000\r
+\r
+If the basic query passed to `notmuch-show' generates no results,\r
+throw an error and inform the user that no messages matched the query\r
+rather than displaying an empty buffer and showing an obscure error.\r
+---\r
+ emacs/notmuch-show.el | 8 +++++++-\r
+ 1 file changed, 7 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 3345878..335992e 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1248,7 +1248,13 @@ function is used."\r
+       (when (and (eq (buffer-size) 0)\r
+                  notmuch-show-query-context)\r
+         (notmuch-show-insert-forest\r
+-         (notmuch-query-get-threads (append cli-args basic-args)))))\r
++         (notmuch-query-get-threads (append cli-args basic-args))))\r
++\r
++      ;; If there are still no results, kill the buffer and throw an\r
++      ;; error.\r
++      (when (eq (buffer-size) 0)\r
++        (kill-buffer (current-buffer))\r
++        (error "No messages matched the query.")))\r
\r
+       (jit-lock-register #'notmuch-show-buttonise-links)\r
\r
+-- \r
+2.1.4\r
+\r