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 A78866DE0B25 for ; Sat, 6 Feb 2016 10:21:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.236 X-Spam-Level: X-Spam-Status: No, score=0.236 tagged_above=-999 required=5 tests=[AWL=0.303, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 BJMpd_j_GA0r for ; Sat, 6 Feb 2016 10:21:38 -0800 (PST) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 64B866DE0A94 for ; Sat, 6 Feb 2016 10:21:38 -0800 (PST) Received: by mail-wm0-f67.google.com with SMTP id 128so8335572wmz.3 for ; Sat, 06 Feb 2016 10:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=Yb6ETgawWwG2FbeJG26fdWUxoJKClL7JtLup7c6ytrg=; b=UxLAe2KCyeT6t4GDXcqTS2FBYQnnBbtwWogcpY2FRoizaZo4vUux0j2fQcRq5sJg8+ lpweUxL3bYRLoxHWGjof1vO4uHhdqLEMRBa0IpFZuzyPeA9hT7Ved0RznFmhZd9MExfY rZu0R46TUKUV+PLhxHK4NOOEGg1IlN+CsApO7nPK5gPV9MMcfHeE1hWhvJW7F/XJbzFX 9zKLxsHEPgzvymTo8rB1+BKb6Eo5fP+xLv4shhLDYXT4m4pJvBlRj+wi7wj4t4MozDrz 8v5Q0nu+oqR8eEHEejjYVsVD5OBqbCSzEkIRcCVxynD+e6IpH4Lg7jql4HfIqZJ+hMlP dKJA== 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:date:message-id:in-reply-to :references; bh=Yb6ETgawWwG2FbeJG26fdWUxoJKClL7JtLup7c6ytrg=; b=TnKoubYP2Y5nx6aZlHVmnXiwvKoWaoATK4z7kSYlFJ+IYeP9NWfaYGq8tMsI6NniAE wO1njc2Q+Nq1WnIWEAPVX8Av0csQEAdxLIoFDtTr8DIsrOUmci88MWz/UGSCq1gNoNyf BMONPaWGO3fg7Ve2jCZddc43aQGH7mr869fRmbT+RjmnErzMcJw+m1cANNcKAj6t5+t4 Y0L/pmg0gVO3yOVXPbnJnzPOW90DPVtSu4ToXMF+sBRE34FSqXiGyo3z+rtezPFqjeXU 9/Nq/oIZR47VvfLs5BHGWQ7kxSI2m+hNzGweOlYCDrDY/gF7utTfeq3DWSqtDIzb5Ivp KPGQ== X-Gm-Message-State: AG10YOR6JnVEmtFfToCqM6F84wEY4lI35Q/0q5hZ7jhYovdDfqQHAuM0JzHMVRLMHSkL4g== X-Received: by 10.194.95.70 with SMTP id di6mr22487138wjb.2.1454782897077; Sat, 06 Feb 2016 10:21:37 -0800 (PST) Received: from disaster-area.hh.sledj.net ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) by smtp.gmail.com with ESMTPSA id e19sm1232744wmd.1.2016.02.06.10.21.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Feb 2016 10:21:35 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 25260799 for ; Sat, 6 Feb 2016 18:21:32 +0000 (UTC) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. Date: Sat, 6 Feb 2016 18:21:32 +0000 Message-Id: <1454782892-1690-2-git-send-email-dme@dme.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454782892-1690-1-git-send-email-dme@dme.org> References: <1454782892-1690-1-git-send-email-dme@dme.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: Sat, 06 Feb 2016 18:21:40 -0000 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. --- 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