From: Uli Scholler Date: Wed, 2 Sep 2015 21:57:14 +0000 (+0200) Subject: [PATCH] emacs: wrap current search in parens when filtering X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3db83127ad6f727345ce5fcd449073f30866ff7b;p=notmuch-archives.git [PATCH] emacs: wrap current search in parens when filtering --- diff --git a/5a/1ace23a217a08fa3851fc4c9b9b755c786a7a4 b/5a/1ace23a217a08fa3851fc4c9b9b755c786a7a4 new file mode 100644 index 000000000..a354fa6a9 --- /dev/null +++ b/5a/1ace23a217a08fa3851fc4c9b9b755c786a7a4 @@ -0,0 +1,84 @@ +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 0B12A6DE0FF8 + for ; Wed, 2 Sep 2015 15:07:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 qtExqUGSYogw for ; + Wed, 2 Sep 2015 15:07:34 -0700 (PDT) +X-Greylist: delayed 501 seconds by postgrey-1.35 at arlo; + Wed, 02 Sep 2015 15:07:34 PDT +Received: from idun.ftbfs.de (idun.ftbfs.de [78.47.2.106]) + by arlo.cworth.org (Postfix) with ESMTP id AFD2F6DE0FB1 + for ; Wed, 2 Sep 2015 15:07:34 -0700 (PDT) +Received: from localhost (localidun [10.0.0.76]) + by idun.ftbfs.de (Postfix) with ESMTP id B16B9EC379 + for ; Wed, 2 Sep 2015 23:59:09 +0200 (CEST) +Received: from localhost ([10.0.0.76]) + by localhost (idun.ftbfs.de [10.0.0.76]) (amavisd-new, port 2525) + with SMTP id 14779-18 for ; + Wed, 2 Sep 2015 23:58:10 +0200 (CEST) +Received: from saga.ftbfs.de (unknown [10.0.0.77]) + by idun.ftbfs.de (Postfix) with ESMTP id EB221EC377; + Wed, 2 Sep 2015 23:58:07 +0200 (CEST) +Received: by saga.ftbfs.de (Postfix, from userid 10) + id 365231AC0A5; Wed, 2 Sep 2015 23:58:07 +0200 (CEST) +Received: by tardis.scholler.priv (Postfix, from userid 1000) + id 3019B104; Wed, 2 Sep 2015 23:57:29 +0200 (CEST) +From: Uli Scholler +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: wrap current search in parens when filtering +Date: Wed, 2 Sep 2015 23:57:14 +0200 +Message-Id: <1441231034-9413-1-git-send-email-uli@scholler.net> +X-Mailer: git-send-email 2.1.4 +X-Virus-Scanned: at idun.ftbfs.de with p-bank undefined +X-Mailman-Approved-At: Thu, 03 Sep 2015 00:24:54 -0700 +Cc: Uli Scholler +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Wed, 02 Sep 2015 22:07:37 -0000 + +When filtering the current search further with notmuch-search-filter, +wrap the current search in parens. + +This fixes unexpected behavior when the current search is +complex (like "(tag:this and date:one_week_ago..) or tag:that"). +--- + emacs/notmuch.el | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 5284e77..a98ec96 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -989,7 +989,7 @@ current search results AND the additional query string provided." + query))) + (notmuch-search (if (string= notmuch-search-query-string "*") + grouped-query +- (concat notmuch-search-query-string " and " grouped-query)) notmuch-search-oldest-first))) ++ (concat "(" notmuch-search-query-string ") and " grouped-query)) notmuch-search-oldest-first))) + + (defun notmuch-search-filter-by-tag (tag) + "Filter the current search results based on a single tag. +-- +2.1.4 + +