--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0F229431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 19 May 2014 14:56:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.502\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.502 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id JiNI5Uvj6Xrn for <notmuch@notmuchmail.org>;\r
+ Mon, 19 May 2014 14:56:03 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 01830431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 19 May 2014 14:56:02 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WmVXH-00026X-W4; Mon, 19 May 2014 22:55:58 +0100\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WmVXH-0006Qk-Kd; Mon, 19 May 2014 22:55:55 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v1] emacs: `notmuch-search-find-stable-query-region'\r
+ should never return an empty query.\r
+In-Reply-To: <1400515756-31779-1-git-send-email-dme@dme.org>\r
+References: <1400515756-31779-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 19 May 2014 22:55:53 +0100\r
+Message-ID: <87lhtxzb4m.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 490e9304c59b23241557a095be86b02d (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 19 May 2014 21:56:11 -0000\r
+\r
+\r
+On Mon, 19 May 2014, David Edmondson <dme@dme.org> wrote:\r
+> `notmuch-search-find-stable-query-region' is expected to examine the\r
+> region between `beg' and `end' to generate a query that can be used to\r
+> include all threads in that region. If the region contains no threads,\r
+> it should throw an error rather than generating an empty query.\r
+\r
+Hi\r
+\r
+This seems a very definite bug (when testing I managed to archive a\r
+whole chunk of random messages!) \r
+\r
+However, I think I would prefer not to signal an error and just do\r
+nothing. How about making notmuch-tag check for a nil query (and do\r
+nothing it's nil). Then rather than an error n.s.f.s.q.r can just return\r
+nil (this still needs to be special cased as otherwise we get "()" as\r
+the query.\r
+\r
+Doing this would also fix a bug I found (when seeing what we did\r
+elsewhere based on the above) in notmuch-tree: trying to change tags at\r
+the end of the buffer gives an error).\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+> ---\r
+>\r
+> Whilst logging calls to 'notmuch' from the UI, I noticed that it would generate\r
+> notmuch tag -inbox -- ()\r
+> if I hit 'a' at the very end of a search buffer. That seems at least\r
+> useless and possibly bad, so flag an error in this case instead.\r
+>\r
+> Oh, the first bit is just cleanup.\r
+>\r
+> emacs/notmuch.el | 5 ++++-\r
+> 1 file changed, 4 insertions(+), 1 deletion(-)\r
+>\r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index 8aa0104..74103a6 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -429,12 +429,15 @@ matched and unmatched messages in the current thread."\r
+> \r
+> If ONLY-MATCHED is non-nil, include only matched messages. If it\r
+> is nil, include both matched and unmatched messages."\r
+> - (let ((query-list nil) (all (not only-matched)))\r
+> + (let ((all (not only-matched))\r
+> + query-list)\r
+> (dolist (queries (notmuch-search-properties-in-region :query beg end))\r
+> (when (first queries)\r
+> (push (first queries) query-list))\r
+> (when (and all (second queries))\r
+> (push (second queries) query-list)))\r
+> + (unless query-list\r
+> + (error "No threads in region."))\r
+> (concat "(" (mapconcat 'identity query-list ") or (") ")")))\r
+> \r
+> (defun notmuch-search-find-authors ()\r
+> -- \r
+> 2.0.0.rc0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r