Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 141B1431FBC for ; Mon, 19 May 2014 09:09:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e-OCpqxzafbN for ; Mon, 19 May 2014 09:09:24 -0700 (PDT) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C9642431FAF for ; Mon, 19 May 2014 09:09:23 -0700 (PDT) Received: by mail-we0-f171.google.com with SMTP id w62so5798167wes.16 for ; Mon, 19 May 2014 09:09:19 -0700 (PDT) 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; bh=6DaI1fcCp1FrHP2fUzpI4hqGpX29SDdZWiXouuu7r68=; b=a1yf9f32/6xLtnm4cf5xTXrvjIWbAdPTIV8roujA/3YHuSSXvlRKKqwuY63Ye1rDx4 3213AHnsoGFzsR3TCkwEsZRnF1hehOAtYl3ntaaMBJbILjrkxsbXGtIh1h99kLqXNU1+ ZHdtpDiI8T1OUZMXxtkTEjhrbyzXVdg/1o1toGJhe/r45D8GHD2abFqejZvtD3UNdFjk SWYFN51SUQmmZ2hlqffv4WfjYIvOXKZzOUVvRZ7kpz/8SeV3KkCREUipwnLVtk+AXdzZ KhWva646ixBSJl2clRLDq0HLAx5U0e/kcXU/yf18hKYEPJh6Q/cOGgsulYyWBq4SPKH8 1Tig== X-Gm-Message-State: ALoCoQn0pTjvBNCNDqY0o1OOTG8+2mSSPBwLwX0yrrDJAWZ+qXodtECvviwNf5+qEDnUKNHk8v4C X-Received: by 10.180.11.196 with SMTP id s4mr3305804wib.34.1400515759536; Mon, 19 May 2014 09:09:19 -0700 (PDT) Received: from hotblack-desiato.hh.sledj.net ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8]) by mx.google.com with ESMTPSA id nb8sm15760615wic.18.2014.05.19.09.09.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 May 2014 09:09:18 -0700 (PDT) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 8CD9410FF2D; Mon, 19 May 2014 17:09:16 +0100 (BST) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v1] emacs: `notmuch-search-find-stable-query-region' should never return an empty query. Date: Mon, 19 May 2014 17:09:16 +0100 Message-Id: <1400515756-31779-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 2.0.0.rc0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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, 19 May 2014 16:09:28 -0000 `notmuch-search-find-stable-query-region' is expected to examine the region between `beg' and `end' to generate a query that can be used to include all threads in that region. If the region contains no threads, it should throw an error rather than generating an empty query. --- Whilst logging calls to 'notmuch' from the UI, I noticed that it would generate notmuch tag -inbox -- () if I hit 'a' at the very end of a search buffer. That seems at least useless and possibly bad, so flag an error in this case instead. Oh, the first bit is just cleanup. emacs/notmuch.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 8aa0104..74103a6 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -429,12 +429,15 @@ matched and unmatched messages in the current thread." If ONLY-MATCHED is non-nil, include only matched messages. If it is nil, include both matched and unmatched messages." - (let ((query-list nil) (all (not only-matched))) + (let ((all (not only-matched)) + query-list) (dolist (queries (notmuch-search-properties-in-region :query beg end)) (when (first queries) (push (first queries) query-list)) (when (and all (second queries)) (push (second queries) query-list))) + (unless query-list + (error "No threads in region.")) (concat "(" (mapconcat 'identity query-list ") or (") ")"))) (defun notmuch-search-find-authors () -- 2.0.0.rc0