Re: [PATCH 2/2] emacs: Improve the regexp used to match id:'s in messages
authorJani Nikula <jani@nikula.org>
Wed, 31 Oct 2012 10:00:08 +0000 (11:00 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:14 +0000 (09:50 -0800)
a0/eeca574d5fdb73c7856cac62fecdb80fe1d7bd [new file with mode: 0644]

diff --git a/a0/eeca574d5fdb73c7856cac62fecdb80fe1d7bd b/a0/eeca574d5fdb73c7856cac62fecdb80fe1d7bd
new file mode 100644 (file)
index 0000000..3a337a2
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id EB760431FBD\r
+       for <notmuch@notmuchmail.org>; Wed, 31 Oct 2012 03:00:16 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id mxbvFuc6cxmy for <notmuch@notmuchmail.org>;\r
+       Wed, 31 Oct 2012 03:00:15 -0700 (PDT)\r
+Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com\r
+       [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E583F431FBC\r
+       for <notmuch@notmuchmail.org>; Wed, 31 Oct 2012 03:00:14 -0700 (PDT)\r
+Received: by mail-vc0-f181.google.com with SMTP id n11so1505336vch.26\r
+       for <notmuch@notmuchmail.org>; Wed, 31 Oct 2012 03:00:13 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
+       :message-id:mime-version:content-type:x-gm-message-state;\r
+       bh=+FqGvOxfO3NVFiAVmrtKh3/AjY2x3oCnFOgn/DQG5XM=;\r
+       b=dGwExtmZObL2gsuGK10a0Xph9uVBOZoGxC95UPgwkDAPVQN2h7NGmljvqPo6I1UpwP\r
+       1kYfqiyTLLaKG4iw6IqxlajvDnWlA3XtImW86+AOqVu9vGOhPyxQfHMJ/vv2mAAr4KEb\r
+       S0tJutelHI8gKa4n83BWBMDHw6YpoRVEokGvo8KfVaBpoKg5KbOs/W0L3IPfSt3f6kFL\r
+       pMPcO9TK5jb7iZ2Pi0/wAdH0KQ9V5uRjkRjl+1Qpvwda4BxOGWqGFG7fXn8JxcKqapqD\r
+       IPE9SjmS6j2wveZdP95V9Fqh/lTGoOyBc2P7PflRQk6cUD5zrQQWNTAET02+moZsAJQq\r
+       OFhw==\r
+Received: by 10.58.172.103 with SMTP id bb7mr18743720vec.41.1351677612831;\r
+       Wed, 31 Oct 2012 03:00:12 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+       by mx.google.com with ESMTPS id gl6sm1699588vec.4.2012.10.31.03.00.10\r
+       (version=SSLv3 cipher=OTHER); Wed, 31 Oct 2012 03:00:11 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 2/2] emacs: Improve the regexp used to match id:'s in\r
+       messages\r
+In-Reply-To: <1351650561-7331-3-git-send-email-amdragon@mit.edu>\r
+References: <1351650561-7331-1-git-send-email-amdragon@mit.edu>\r
+       <1351650561-7331-3-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.14+39~ge21970d (http://notmuchmail.org) Emacs/23.2.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Wed, 31 Oct 2012 11:00:08 +0100\r
+Message-ID: <87mwz3x8pj.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQm1mplnCkGS8LAAh6vktTKztrDNmjRPEwjwMyiUPkQD1o+n2/jpg9l5Q8o07aJ25a+Tq0o/\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 31 Oct 2012 10:00:17 -0000\r
+\r
+On Wed, 31 Oct 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> This regexp agrees with Xapian query syntax much more closely, though\r
+> we specifically disallow various cases that would be confusing in the\r
+> context of an email body (e.g., punctuation at the end of an id: link\r
+> is not considered part of the id: link because it's probably part of\r
+> the surrounding text).\r
+>\r
+> In particular, this handles id: links that are not surrounded by\r
+> quotes much better, which stash is much more likely to generate now\r
+> that we don't quote id's that don't need to be quoted.  It also\r
+> handles quoted id: links better.\r
+>\r
+> We update the buttonization test to reflect the new pattern.\r
+\r
+Hi Austin, all of this looks good as-is, but I propose the changes below\r
+on top. (With the relevant comment changed too.)\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index e96e099..117eb0e 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1005,7 +1005,7 @@ message at DEPTH in the current thread."\r
+    ;; next space or ).  We disallow [.,;] as the last character\r
+    ;; because these are probably part of the surrounding text, and not\r
+    ;; part of the id.  This doesn't match single character ids; meh.\r
+-   "\\|[^\"[:space:])][^[:space:])]*[^[:space:]).,;]"\r
++   "\\|[^\"[:space:])][^[:space:])]*[^])[:space:].,:;?!]"\r
+    "\\)")\r
+   "The regexp used to match id: links in messages.")\r
\r
+diff --git a/test/emacs-show b/test/emacs-show\r
+index e16483c..e2d7c70 100755\r
+--- a/test/emacs-show\r
++++ b/test/emacs-show\r
+@@ -109,7 +109,12 @@ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off\r
+ test_begin_subtest "id buttonization"\r
+ add_message '[body]="\r
+ id:abc\r
+-id:abc.def. id:abc,def, id:abc;def;\r
++id:abc.def. id:abc,def, id:abc;def; id:abc:def:\r
++id:foo@bar.?baz? id:foo@bar!.baz!\r
++(id:foo@bar.baz) [id:foo@bar.baz]\r
++id:foo@bar.baz...\r
++id:2+2=5\r
++id:=_-:/.[]@$%+\r
+ id:abc)def\r
+ id:ab\"c def\r
+ id:\"abc\"def\r
+@@ -131,7 +136,12 @@ To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
+ Date: Fri, 05 Jan 2001 15:43:57 +0000\r
\r
+ <<id:abc>>\r
+-<<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>;\r
++<<id:abc.def>>. <<id:abc,def>>, <<id:abc;def>>; <<id:abc:def>>:\r
++<<id:foo@bar.?baz>>? <<id:foo@bar!.baz>>!\r
++(<<id:foo@bar.baz>>) [<<id:foo@bar.baz>>]\r
++<<id:foo@bar.baz>>...\r
++<<id:2+2=5>>\r
++<<id:=_-:/.[]@$%+>>\r
+ <<id:abc>>)def\r
+ <<id:ab"c>> def\r
+ <<id:"abc">>def\r