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