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 C79C5431FBC for ; Thu, 15 Nov 2012 11:50:05 -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 Z6Y79Dsek1jo for ; Thu, 15 Nov 2012 11:50:03 -0800 (PST) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 8311D431FBD for ; Thu, 15 Nov 2012 11:50:03 -0800 (PST) X-AuditID: 1209190f-b7f636d00000095b-48-50a5476b8577 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id CF.04.02395.B6745A05; Thu, 15 Nov 2012 14:50:03 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qAFJo1Y4005194; Thu, 15 Nov 2012 14:50:01 -0500 Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAFJnuf5018787 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Thu, 15 Nov 2012 14:49:59 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TZ5Rk-0004YD-Nm; Thu, 15 Nov 2012 14:49:56 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v3 2/3] emacs: Improve the regexp used to match id:'s in messages Date: Thu, 15 Nov 2012 14:49:53 -0500 Message-Id: <1353008994-17305-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1353008994-17305-1-git-send-email-amdragon@mit.edu> References: <1353008994-17305-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHIsWRmVeSWpSXmKPExsUixCmqrZvtvjTAYPMuNovrN2cyW7xZOY/V gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4Mp4MekwU8Fh6YqXLc2sDYwHxLoYOTkkBEwk vm06xAxhi0lcuLeerYuRi0NIYB+jxOJ/U6CcDYwSb2bNZ4JwTjFJnNx6jwXCmcso8fX8DrB+ NgENiW37lzOC2CIC0hI7785mBbGZBawkDl/dBGYLCwRKNN84ywZiswioStye8xMszivgIDHp 4USoOxQlup9NAKvhFHCUOHJpJpgtBFRz7+NdtgmM/AsYGVYxyqbkVunmJmbmFKcm6xYnJ+bl pRbpmujlZpbopaaUbmIEB5Mk/w7GbweVDjEKcDAq8fCeuLk4QIg1say4MvcQoyQHk5Iob6LN 0gAhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIryeckA53pTEyqrUonyYlDQHi5I479WUm/5CAumJ JanZqakFqUUwWRkODiUJ3m1uQI2CRanpqRVpmTklCGkmDk6Q4TxAw7eC1PAWFyTmFmemQ+RP MSpKifNuAEkIgCQySvPgemHR/opRHOgVYd6rIFU8wEQB1/0KaDAT0OAtMktABpckIqSkGhin d6ytcLy55UxFYsDpqHN/WbcZd4mmWLXunfNcT/qb70XhXpszDBoPrjpnCRzxW/SFmXdyYM6p k76CdUsffZpaOy0h64n0yoZjwS+uZKU2922quu1z8fO9ORMijqpdOb1d7/Xzd9qKv5tk+uIu 1Sfc2310e6i13+PPfQZnvkxpOJK3a8FPH5e3SizFGYmGWsxFxYkAxALfINECAAA= Cc: tomi.ollila@iki.fi 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: Thu, 15 Nov 2012 19:50:06 -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 OUTPUT EXPECTED -- 1.7.10.4