Re: [PATCH 1/4] emacs: new customization variable to exclude "deleted" messages from...
authorAustin Clements <amdragon@MIT.EDU>
Mon, 9 Jan 2012 02:46:10 +0000 (21:46 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:48 +0000 (09:41 -0800)
f8/8a5feb36f62f2b4c42b577948ba9a7e5ae1722 [new file with mode: 0644]

diff --git a/f8/8a5feb36f62f2b4c42b577948ba9a7e5ae1722 b/f8/8a5feb36f62f2b4c42b577948ba9a7e5ae1722
new file mode 100644 (file)
index 0000000..57da55a
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <amdragon@mit.edu>\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 94E97431FD0\r
+       for <notmuch@notmuchmail.org>; Sun,  8 Jan 2012 18:45:59 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 ilfxwLo53cZh for <notmuch@notmuchmail.org>;\r
+       Sun,  8 Jan 2012 18:45:59 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
+       [18.9.25.13])\r
+       by olra.theworths.org (Postfix) with ESMTP id D7F41431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  8 Jan 2012 18:45:58 -0800 (PST)\r
+X-AuditID: 1209190d-b7fbf6d0000008ba-24-4f0a54e6c6ff\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id CD.33.02234.6E45A0F4; Sun,  8 Jan 2012 21:45:58 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q092jvHj032248; \r
+       Sun, 8 Jan 2012 21:45:58 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q092jufe011533\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sun, 8 Jan 2012 21:45:57 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@MIT.EDU>)\r
+       id 1Rk5FS-0005zr-G1; Sun, 08 Jan 2012 21:46:10 -0500\r
+Date: Sun, 8 Jan 2012 21:46:10 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>\r
+Subject: Re: [PATCH 1/4] emacs: new customization variable to exclude\r
+       "deleted" messages from search\r
+Message-ID: <20120109024610.GF20796@mit.edu>\r
+References: <1325975294-646-1-git-send-email-jrollins@finestructure.net>\r
+       <1325975294-646-2-git-send-email-jrollins@finestructure.net>\r
+       <m2wr91ismu.fsf@gmail.com> <20120109014938.GE20796@mit.edu>\r
+       <87ehv9r4co.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: 8bit\r
+In-Reply-To: <87ehv9r4co.fsf@servo.finestructure.net>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrKKsWRmVeSWpSXmKPExsUixCmqrPsshMvfYO5/UYtpy7+wW+zZ52Vx\r
+       /eZMZgdmj7unuTx2zrrL7vFs1S3mAOYoLpuU1JzMstQifbsErozdt1+yF/SLVHTeOMPewHiO\r
+       v4uRk0NCwETi5N8fLBC2mMSFe+vZuhi5OIQE9jFKPPi9hBHCWc8ocej2VGYI5wSTxJr2qSwQ\r
+       zhJGiSP9rawg/SwCKhItzT/ZQGw2AQ2JbfuXM4LYIgJmEj1f/oDZzAI+Eif+7gGrERZIk7g2\r
+       dTE7iM0roCOxZ+NsJoihnxgldixsZ4ZICEqcnPmEBaJZXeLPvEtAcQ4gW1pi+T8OiLC8RPPW\r
+       2WDlnAKmEp+v3AObLwp0z5ST29gmMArPQjJpFpJJsxAmzUIyaQEjyypG2ZTcKt3cxMyc4tRk\r
+       3eLkxLy81CJdI73czBK91JTSTYzg2JDk3cH47qDSIUYBDkYlHl4BGy5/IdbEsuLK3EOMkhxM\r
+       SqK8BsFAIb6k/JTKjMTijPii0pzU4kOMEhzMSiK8AmZAOd6UxMqq1KJ8mJQ0B4uSOK+q1js/\r
+       IYH0xJLU7NTUgtQimKwMB4eSBO88YAoQEixKTU+tSMvMKUFIM3FwggznARqeDFLDW1yQmFuc\r
+       mQ6RP8WoKCXOawySEABJZJTmwfXCUtcrRnGgV4R5I0GqeIBpD677FdBgJqDBD/6wgwwuSURI\r
+       STUwsorkNxjwqzi3F3fyMrfW/uePK9ucuKx0wQa3zRxn7ZZwuPTPW7i5JT7nsZxxwPn4+DXB\r
+       u6bG5V8tf90t4OX4LPNdtsizmY/XnBPc3pok/O4mx7TtV/7VVHEarNnQLtTC8cuRxenSmbtf\r
+       PNd0fRTh0lnD16BpWBU9oV/j81qG6df1lfboH/JWYinOSDTUYi4qTgQAJf7WgjgDAAA=\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>\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, 09 Jan 2012 02:45:59 -0000\r
+\r
+Quoth Jameson Graef Rollins on Jan 08 at  6:34 pm:\r
+> On Sun, 8 Jan 2012 20:49:38 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> > > > @@ -927,6 +932,9 @@ The optional parameters are used as follows:\r
+> > > >      (set 'notmuch-search-target-thread target-thread)\r
+> > > >      (set 'notmuch-search-target-line target-line)\r
+> > > >      (set 'notmuch-search-continuation continuation)\r
+> > > > +    (when (and notmuch-search-exclude-deleted\r
+> > > > +             (not (string-match "tag:deleted[ )]*" query)))\r
+> > > \r
+> > > “is:” is a synonym for “tag:” in searches – so this section of the code\r
+> > > should look for it too.\r
+> > \r
+> > There are several other things that could also trip up this regexp.\r
+> > xtag:deletedx would be falsely matched, as would a quoted phrase\r
+> > containing "tag:deleted", while tag:"deleted" and tag:(deleted) would\r
+> > incorrectly not be matched.\r
+> \r
+> Thanks so much for the review, guys.  I should have mentioned in this\r
+> patch that the my regex skills are very weak, and that it was surely\r
+> incomplete.  I always forget about the is: prefix as well.\r
+> \r
+> > Getting this right is hard, though I'd be happy with\r
+> > \r
+> >   "\\<\\(tag\\|is\\):deleted\\>"\r
+> \r
+> Every time I think I start to understand regex I am reminded that it's\r
+> black magic and I really know nothing.  For instance, I am not familiar\r
+> with "<" or ">", although they appear to be a "word" boundaries\r
+> (although I'm not sure how "word" is defined).  Also, why is all the \\\r
+> (double?)  escaping needed?  I'll certainly take your word for it,\r
+> though.\r
+\r
+I'm not positive, but I think \> matches on the transition from a\r
+"word-constituent" character to a non-word-constituent character, as\r
+defined by Emacs' active syntax table.\r
+\r
+The slashes are all doubled because I was writing it as an Emacs\r
+string for easy pasting (sorry, I should have been explicit about\r
+that).  The regexp itself is\r
+\r
+  \<\(tag\|is\):deleted\>\r
+\r
+> > or maybe\r
+> > \r
+> >   "\\<\\(tag\\|is\\):\\(\"?\\)deleted\\>\\2"\r
+> \r
+> After staring at this for 10 minutes I think I'm getting the extra bits\r
+> here.  It matches an initial \", and then a second at the end if the\r
+> first matched.  That's clever.  Why \r
+\r
+Exactly.\r
+\r
+>   \\>\\2\r
+> \r
+> instead of\r
+> \r
+>  \\2\\>\r
+> \r
+> ?\r
+\r
+Okay, that can qualify as black magic.  The problem is that a " will\r
+mess up the word-boundary matching because " isn't a word constituent\r
+character.  So, if it is looking for a quote at the end, the \2 in\r
+\2\> would match and consume the ", but then the \> wouldn't match.\r