On Wed, 31 Oct 2012, Austin Clements <amdragon@MIT.EDU> wrote: > 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. Hi Austin, all of this looks good as-is, but I propose the changes below on top. (With the relevant comment changed too.) BR, Jani. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index e96e099..117eb0e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1005,7 +1005,7 @@ message at DEPTH in the current thread." ;; next space or ). We disallow [.,;] as the last character ;; because these are probably part of the surrounding text, and not ;; part of the id. This doesn't match single character ids; meh. - "\\|[^\"[:space:])][^[:space:])]*[^[:space:]).,;]" + "\\|[^\"[:space:])][^[:space:])]*[^])[:space:].,:;?!]" "\\)") "The regexp used to match id: links in messages.") diff --git a/test/emacs-show b/test/emacs-show index e16483c..e2d7c70 100755 --- a/test/emacs-show +++ b/test/emacs-show @@ -109,7 +109,12 @@ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off test_begin_subtest "id buttonization" add_message '[body]=" id:abc -id:abc.def. id:abc,def, id:abc;def; +id:abc.def. id:abc,def, id:abc;def; id:abc:def: +id:foo@bar.?baz? id:foo@bar!.baz! +(id:foo@bar.baz) [id:foo@bar.baz] +id:foo@bar.baz... +id:2+2=5 +id:=_-:/.[]@$%+ id:abc)def id:ab\"c def id:\"abc\"def @@ -131,7 +136,12 @@ To: Notmuch Test Suite <test_suite@notmuchmail.org> Date: Fri, 05 Jan 2001 15:43:57 +0000 <<id:abc>> -<<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>; +<<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>; <<id:abc:def>>: +<<id:foo@bar.?baz>>? <<id:foo@bar!.baz>>! +(<<id:foo@bar.baz>>) [<<id:foo@bar.baz>>] +<<id:foo@bar.baz>>... +<<id:2+2=5>> +<<id:=_-:/.[]@$%+>> <<id:abc>>)def <<id:ab"c>> def <<id:"abc">>def