From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id EB597431FBF for ; Sat, 10 Nov 2012 20:46:49 -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 iuyUY+S+Cvfp for ; Sat, 10 Nov 2012 20:46:47 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id EDA66431FC4 for ; Sat, 10 Nov 2012 20:46:35 -0800 (PST) X-AuditID: 12074423-b7fab6d0000008f9-3d-509f2dab8c2c Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id 7E.10.02297.BAD2F905; Sat, 10 Nov 2012 23:46:35 -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 qAB4kObj008282; Sat, 10 Nov 2012 23:46:24 -0500 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 qAB4kJcE001918 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 10 Nov 2012 23:46:21 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TXPR5-0003a5-NI; Sat, 10 Nov 2012 23:46:19 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2 2/3] emacs: Improve the regexp used to match id:'s in messages Date: Sat, 10 Nov 2012 23:46:14 -0500 Message-Id: <1352609175-12790-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1352609175-12790-1-git-send-email-amdragon@mit.edu> References: <1352609175-12790-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrLtad36AwflmBYum6c4W12/OZLZo 7XvK4sDscev+a3aPZ6tuMXts/PuDJYA5issmJTUnsyy1SN8ugStj5beHTAWHpSuW31jK2sB4 QKyLkZNDQsBEonP9GzYIW0ziwr31QDYXh5DAPkaJ81PXMkM4GxglHkyYxQjhPGKSWNL+nB2k RUhgLqPEmscBIDabgIbEtv3LGUFsEQFpiZ13Z7OC2MwCqRKrd3Ywg9jCAoES/fu2gsVZBFQl utoXsoDYvAIOEif/32aEOENRovvZBLCTOAUcJfpn/GGE2OUgcebHe+YJjPwLGBlWMcqm5Fbp 5iZm5hSnJusWJyfm5aUW6Zrp5WaW6KWmlG5iBAUXu4vyDsY/B5UOMQpwMCrx8N54My9AiDWx rLgy9xCjJAeTkihvss78ACG+pPyUyozE4oz4otKc1OJDjBIczEoivLU7gMp5UxIrq1KL8mFS 0hwsSuK811Ju+gsJpCeWpGanphakFsFkZTg4lCR4Y0GGChalpqdWpGXmlCCkmTg4QYbzAA1/ pAVUw1tckJhbnJkOkT/FqCglzsuhDZQQAElklObB9cKi/xWjONArwrxBICt4gIkDrvsV0GAm oMGNR+aADC5JREhJNTAKtit8N35XJb5X/vipWvMJOT8Vju6WWSXw9N/WH60Rn7eu9DnxNOjf FaFLG2Z8C/bd2ljGKCTYviohNugRZ1VAdeGmhIrfizSWtxw18nu9JKXrEb9BQFPwu+X2sy9v 4PhaKWUv6HD4UejxJuk0qfm7jDLX1b6XD7//8I3kbT/WZ6tWf9suomSjxFKckWioxVxUnAgA Q244VNkCAAA= Cc: sascha-ml-reply-to-2012-4@silbe.org 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: Sun, 11 Nov 2012 04:46:50 -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 | 20 ++++++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index d061367..49961fb 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -996,6 +996,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 EXPECTED OUTPUT -- 1.7.10.4