unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] emacs: Improve the regexp used to match id:'s in messages
Date: Wed, 31 Oct 2012 11:00:08 +0100	[thread overview]
Message-ID: <87mwz3x8pj.fsf@nikula.org> (raw)
In-Reply-To: <1351650561-7331-3-git-send-email-amdragon@mit.edu>

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

  reply	other threads:[~2012-10-31 10:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31  2:29 [PATCH 0/2] Better id: link buttonization Austin Clements
2012-10-31  2:29 ` [PATCH 1/2] test: Test buttonization of id: links Austin Clements
2012-10-31  2:29 ` [PATCH 2/2] emacs: Improve the regexp used to match id:'s in messages Austin Clements
2012-10-31 10:00   ` Jani Nikula [this message]
2012-11-01 14:01   ` Sascha Silbe
2012-11-02 19:27     ` Jameson Graef Rollins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwz3x8pj.fsf@nikula.org \
    --to=jani@nikula.org \
    --cc=amdragon@MIT.EDU \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).