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 EB760431FBD for ; Wed, 31 Oct 2012 03:00:16 -0700 (PDT) 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 mxbvFuc6cxmy for ; Wed, 31 Oct 2012 03:00:15 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E583F431FBC for ; Wed, 31 Oct 2012 03:00:14 -0700 (PDT) Received: by mail-vc0-f181.google.com with SMTP id n11so1505336vch.26 for ; Wed, 31 Oct 2012 03:00:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:x-gm-message-state; bh=+FqGvOxfO3NVFiAVmrtKh3/AjY2x3oCnFOgn/DQG5XM=; b=dGwExtmZObL2gsuGK10a0Xph9uVBOZoGxC95UPgwkDAPVQN2h7NGmljvqPo6I1UpwP 1kYfqiyTLLaKG4iw6IqxlajvDnWlA3XtImW86+AOqVu9vGOhPyxQfHMJ/vv2mAAr4KEb S0tJutelHI8gKa4n83BWBMDHw6YpoRVEokGvo8KfVaBpoKg5KbOs/W0L3IPfSt3f6kFL pMPcO9TK5jb7iZ2Pi0/wAdH0KQ9V5uRjkRjl+1Qpvwda4BxOGWqGFG7fXn8JxcKqapqD IPE9SjmS6j2wveZdP95V9Fqh/lTGoOyBc2P7PflRQk6cUD5zrQQWNTAET02+moZsAJQq OFhw== Received: by 10.58.172.103 with SMTP id bb7mr18743720vec.41.1351677612831; Wed, 31 Oct 2012 03:00:12 -0700 (PDT) Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) by mx.google.com with ESMTPS id gl6sm1699588vec.4.2012.10.31.03.00.10 (version=SSLv3 cipher=OTHER); Wed, 31 Oct 2012 03:00:11 -0700 (PDT) From: Jani Nikula To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] emacs: Improve the regexp used to match id:'s in messages In-Reply-To: <1351650561-7331-3-git-send-email-amdragon@mit.edu> References: <1351650561-7331-1-git-send-email-amdragon@mit.edu> <1351650561-7331-3-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.14+39~ge21970d (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Wed, 31 Oct 2012 11:00:08 +0100 Message-ID: <87mwz3x8pj.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQm1mplnCkGS8LAAh6vktTKztrDNmjRPEwjwMyiUPkQD1o+n2/jpg9l5Q8o07aJ25a+Tq0o/ 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: Wed, 31 Oct 2012 10:00:17 -0000 On Wed, 31 Oct 2012, Austin Clements 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 Date: Fri, 05 Jan 2001 15:43:57 +0000 <> -<>. <>, <>; +<>. <>, <>; <>: +<>? <>! +(<>) [<>] +<>... +<> +<> <>)def <> def <>def