[Patch v6 5/7] CLI: add notmuch-config support for named queries
[notmuch-archives.git] / f8 / 8a5feb36f62f2b4c42b577948ba9a7e5ae1722
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 94E97431FD0\r
6         for <notmuch@notmuchmail.org>; Sun,  8 Jan 2012 18:45:59 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id ilfxwLo53cZh for <notmuch@notmuchmail.org>;\r
16         Sun,  8 Jan 2012 18:45:59 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id D7F41431FB6\r
20         for <notmuch@notmuchmail.org>; Sun,  8 Jan 2012 18:45:58 -0800 (PST)\r
21 X-AuditID: 1209190d-b7fbf6d0000008ba-24-4f0a54e6c6ff\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id CD.33.02234.6E45A0F4; Sun,  8 Jan 2012 21:45:58 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q092jvHj032248; \r
27         Sun, 8 Jan 2012 21:45:58 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q092jufe011533\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 8 Jan 2012 21:45:57 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@MIT.EDU>)\r
36         id 1Rk5FS-0005zr-G1; Sun, 08 Jan 2012 21:46:10 -0500\r
37 Date: Sun, 8 Jan 2012 21:46:10 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
40 Subject: Re: [PATCH 1/4] emacs: new customization variable to exclude\r
41         "deleted" messages from search\r
42 Message-ID: <20120109024610.GF20796@mit.edu>\r
43 References: <1325975294-646-1-git-send-email-jrollins@finestructure.net>\r
44         <1325975294-646-2-git-send-email-jrollins@finestructure.net>\r
45         <m2wr91ismu.fsf@gmail.com> <20120109014938.GE20796@mit.edu>\r
46         <87ehv9r4co.fsf@servo.finestructure.net>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=utf-8\r
49 Content-Disposition: inline\r
50 Content-Transfer-Encoding: 8bit\r
51 In-Reply-To: <87ehv9r4co.fsf@servo.finestructure.net>\r
52 User-Agent: Mutt/1.5.21 (2010-09-15)\r
53 X-Brightmail-Tracker:\r
54  H4sIAAAAAAAAA+NgFlrKKsWRmVeSWpSXmKPExsUixCmqrPsshMvfYO5/UYtpy7+wW+zZ52Vx\r
55         /eZMZgdmj7unuTx2zrrL7vFs1S3mAOYoLpuU1JzMstQifbsErozdt1+yF/SLVHTeOMPewHiO\r
56         v4uRk0NCwETi5N8fLBC2mMSFe+vZuhi5OIQE9jFKPPi9hBHCWc8ocej2VGYI5wSTxJr2qSwQ\r
57         zhJGiSP9rawg/SwCKhItzT/ZQGw2AQ2JbfuXM4LYIgJmEj1f/oDZzAI+Eif+7gGrERZIk7g2\r
58         dTE7iM0roCOxZ+NsJoihnxgldixsZ4ZICEqcnPmEBaJZXeLPvEtAcQ4gW1pi+T8OiLC8RPPW\r
59         2WDlnAKmEp+v3AObLwp0z5ST29gmMArPQjJpFpJJsxAmzUIyaQEjyypG2ZTcKt3cxMyc4tRk\r
60         3eLkxLy81CJdI73czBK91JTSTYzg2JDk3cH47qDSIUYBDkYlHl4BGy5/IdbEsuLK3EOMkhxM\r
61         SqK8BsFAIb6k/JTKjMTijPii0pzU4kOMEhzMSiK8AmZAOd6UxMqq1KJ8mJQ0B4uSOK+q1js/\r
62         IYH0xJLU7NTUgtQimKwMB4eSBO88YAoQEixKTU+tSMvMKUFIM3FwggznARqeDFLDW1yQmFuc\r
63         mQ6RP8WoKCXOawySEABJZJTmwfXCUtcrRnGgV4R5I0GqeIBpD677FdBgJqDBD/6wgwwuSURI\r
64         STUwsorkNxjwqzi3F3fyMrfW/uePK9ucuKx0wQa3zRxn7ZZwuPTPW7i5JT7nsZxxwPn4+DXB\r
65         u6bG5V8tf90t4OX4LPNdtsizmY/XnBPc3pok/O4mx7TtV/7VVHEarNnQLtTC8cuRxenSmbtf\r
66         PNd0fRTh0lnD16BpWBU9oV/j81qG6df1lfboH/JWYinOSDTUYi4qTgQAJf7WgjgDAAA=\r
67 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
68 X-BeenThere: notmuch@notmuchmail.org\r
69 X-Mailman-Version: 2.1.13\r
70 Precedence: list\r
71 List-Id: "Use and development of the notmuch mail system."\r
72         <notmuch.notmuchmail.org>\r
73 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
75 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
76 List-Post: <mailto:notmuch@notmuchmail.org>\r
77 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
78 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
79         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
80 X-List-Received-Date: Mon, 09 Jan 2012 02:45:59 -0000\r
81 \r
82 Quoth Jameson Graef Rollins on Jan 08 at  6:34 pm:\r
83 > On Sun, 8 Jan 2012 20:49:38 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
84 > > > > @@ -927,6 +932,9 @@ The optional parameters are used as follows:\r
85 > > > >      (set 'notmuch-search-target-thread target-thread)\r
86 > > > >      (set 'notmuch-search-target-line target-line)\r
87 > > > >      (set 'notmuch-search-continuation continuation)\r
88 > > > > +    (when (and notmuch-search-exclude-deleted\r
89 > > > > +              (not (string-match "tag:deleted[ )]*" query)))\r
90 > > > \r
91 > > > “is:” is a synonym for “tag:” in searches – so this section of the code\r
92 > > > should look for it too.\r
93 > > \r
94 > > There are several other things that could also trip up this regexp.\r
95 > > xtag:deletedx would be falsely matched, as would a quoted phrase\r
96 > > containing "tag:deleted", while tag:"deleted" and tag:(deleted) would\r
97 > > incorrectly not be matched.\r
98\r
99 > Thanks so much for the review, guys.  I should have mentioned in this\r
100 > patch that the my regex skills are very weak, and that it was surely\r
101 > incomplete.  I always forget about the is: prefix as well.\r
102\r
103 > > Getting this right is hard, though I'd be happy with\r
104 > > \r
105 > >   "\\<\\(tag\\|is\\):deleted\\>"\r
106\r
107 > Every time I think I start to understand regex I am reminded that it's\r
108 > black magic and I really know nothing.  For instance, I am not familiar\r
109 > with "<" or ">", although they appear to be a "word" boundaries\r
110 > (although I'm not sure how "word" is defined).  Also, why is all the \\\r
111 > (double?)  escaping needed?  I'll certainly take your word for it,\r
112 > though.\r
113 \r
114 I'm not positive, but I think \> matches on the transition from a\r
115 "word-constituent" character to a non-word-constituent character, as\r
116 defined by Emacs' active syntax table.\r
117 \r
118 The slashes are all doubled because I was writing it as an Emacs\r
119 string for easy pasting (sorry, I should have been explicit about\r
120 that).  The regexp itself is\r
121 \r
122   \<\(tag\|is\):deleted\>\r
123 \r
124 > > or maybe\r
125 > > \r
126 > >   "\\<\\(tag\\|is\\):\\(\"?\\)deleted\\>\\2"\r
127\r
128 > After staring at this for 10 minutes I think I'm getting the extra bits\r
129 > here.  It matches an initial \", and then a second at the end if the\r
130 > first matched.  That's clever.  Why \r
131 \r
132 Exactly.\r
133 \r
134 >   \\>\\2\r
135\r
136 > instead of\r
137\r
138 >  \\2\\>\r
139\r
140 > ?\r
141 \r
142 Okay, that can qualify as black magic.  The problem is that a " will\r
143 mess up the word-boundary matching because " isn't a word constituent\r
144 character.  So, if it is looking for a quote at the end, the \2 in\r
145 \2\> would match and consume the ", but then the \> wouldn't match.\r