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 C658C431FC3 for ; Tue, 30 Oct 2012 19:29:42 -0700 (PDT) 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 qLaMTQ5aNXbI for ; Tue, 30 Oct 2012 19:29:41 -0700 (PDT) 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 1ECB3431FC4 for ; Tue, 30 Oct 2012 19:29:37 -0700 (PDT) X-AuditID: 1209190d-b7f906d0000008de-a9-50908d101f56 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 6B.FE.02270.01D80905; Tue, 30 Oct 2012 22:29:36 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q9V2TZD0000788; Tue, 30 Oct 2012 22:29:35 -0400 Received: from drake.dyndns.org (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q9V2TUNu027171 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 30 Oct 2012 22:29:35 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TTO3X-00021Q-TD; Tue, 30 Oct 2012 22:29:23 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 2/2] emacs: Improve the regexp used to match id:'s in messages Date: Tue, 30 Oct 2012 22:29:21 -0400 Message-Id: <1351650561-7331-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1351650561-7331-1-git-send-email-amdragon@mit.edu> References: <1351650561-7331-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsUixG6nrivQOyHAYNlTNYum6c4W12/OZHZg 8rh1/zW7x7NVt5gDmKK4bFJSczLLUov07RK4Mi4tPcVUMEGy4v2+s0wNjEtFuhg5OSQETCQ2 fr/OCmGLSVy4t56ti5GLQ0hgH6PE4WMt7BDOBkaJP5PfQjmPmCTmzv/ICOHMZZR4svELG0g/ m4CGxLb9yxlBbBEBaYmdd2cDzeXgYBYwl7jZEgcSFhbwk1gy9y0TiM0ioCqxtPU1C4jNK2Av 0XtpKtQZ8hJP7/eBjeQUcJB4unUtI8gYIaCa2y8lJjDyL2BkWMUom5JbpZubmJlTnJqsW5yc mJeXWqRrpJebWaKXmlK6iREURpySvDsY3x1UOsQowMGoxMOr8b0/QIg1say4MvcQoyQHk5Io b1HXhAAhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrwXM4ByvCmJlVWpRfkwKWkOFiVx3ispN/2F BNITS1KzU1MLUotgsjIcHEoSvJo9QI2CRanpqRVpmTklCGkmDk6Q4TxAw6NAaniLCxJzizPT IfKnGBWlxHnfdAMlBEASGaV5cL2wOH/FKA70ijCvC0g7DzBFwHW/AhrMBDRYh68XZHBJIkJK qoFxyZLZckbJV8QXRN5ae+Z8xJXzZ1TV3nVfTP4o3Lg32ZrDt9ik1f61bce0y2KWJ3cwLy2s Mt/fdE2+ZiIvx+ejze/eiN+QZr43m6P4z2yxCTeVvF6FPDld/uM1T3m6aqrDvgDbXKMJk7x4 Du2Ve3fslA1XtfeeRzKVf//vs80X/rE3/K3avhg2JZbijERDLeai4kQAlo70BM4CAAA= 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: Wed, 31 Oct 2012 02:29:43 -0000 This regexp agrees with Xapian query syntax much more closely, though we specifically disallow various cases that would be confusing in the context of an email body (e.g., punctuation at the end of an id: link is not considered part of the id: link because it's probably part of the surrounding text). In particular, this handles id: links that are not surrounded by quotes much better, which stash is much more likely to generate now that we don't quote id's that don't need to be quoted. It also handles quoted id: links better. We update the buttonization test to reflect the new pattern. --- emacs/notmuch-show.el | 20 +++++++++++++++++++- test/emacs-show | 14 +++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index f273eb4..e96e099 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -991,6 +991,24 @@ message at DEPTH in the current thread." "Insert the forest of threads FOREST." (mapc (lambda (thread) (notmuch-show-insert-thread thread 0)) forest)) +(defvar notmuch-id-regexp + (concat + ;; Match the id: prefix only if it begins a word (to disallow, for + ;; example, matching cid:). + "\\ Date: Fri, 05 Jan 2001 15:43:57 +0000 <> -<> <> <> -<> -<>"c def +<>. <>, <>; +<>)def +<> def <>def -<>"c"def -id:"ab c"def +<>def +<>def <>.def id:"abc " -<> +id:) id: -c<> +cid:xxx EOF test_expect_equal_file OUTPUT EXPECTED -- 1.7.10