Re: [PATCH 7/6] emacs: relax tag syntax check in `notmuch-tag' function
authorJani Nikula <jani@nikula.org>
Sat, 28 Jan 2012 08:56:21 +0000 (10:56 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:27 +0000 (09:43 -0800)
92/0f1a9ee86f43565ef685eead797242ef24e488 [new file with mode: 0644]

diff --git a/92/0f1a9ee86f43565ef685eead797242ef24e488 b/92/0f1a9ee86f43565ef685eead797242ef24e488
new file mode 100644 (file)
index 0000000..57d0bab
--- /dev/null
@@ -0,0 +1,149 @@
+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 A3BFE431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 00:56:29 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[HTML_MESSAGE=0.001, 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 Yy1h-pRww3GV for <notmuch@notmuchmail.org>;\r
+       Sat, 28 Jan 2012 00:56:29 -0800 (PST)\r
+Received: from mail-pz0-f53.google.com (mail-pz0-f53.google.com\r
+       [209.85.210.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E0145431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 00:56:28 -0800 (PST)\r
+Received: by dadv6 with SMTP id v6so2734198dad.26\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 00:56:27 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.68.189.6 with SMTP id ge6mr21611631pbc.93.1327740981755; Sat,\r
+       28 Jan 2012 00:56:21 -0800 (PST)\r
+Received: by 10.68.236.137 with HTTP; Sat, 28 Jan 2012 00:56:21 -0800 (PST)\r
+Received: by 10.68.236.137 with HTTP; Sat, 28 Jan 2012 00:56:21 -0800 (PST)\r
+In-Reply-To: <1327727143-24455-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+       <1327727143-24455-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+Date: Sat, 28 Jan 2012 10:56:21 +0200\r
+Message-ID:\r
+ <CAB+hUn834oJ+XGx-YyYSGxSnzrBYCMvcu4Vd73ws28qTS2riuA@mail.gmail.com>\r
+Subject: Re: [PATCH 7/6] emacs: relax tag syntax check in `notmuch-tag'\r
+       function\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+Content-Type: multipart/alternative; boundary=e89a8ff1c3e89240a304b792c9df\r
+Cc: notmuch@notmuchmail.org\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: Sat, 28 Jan 2012 08:56:29 -0000\r
+\r
+--e89a8ff1c3e89240a304b792c9df\r
+Content-Type: text/plain; charset=UTF-8\r
+\r
+On Jan 28, 2012 7:06 AM, "Dmitry Kurochkin" <dmitry.kurochkin@gmail.com>\r
+wrote:\r
+>\r
+> The tag syntax check in `notmuch-tag' function was too strict and did\r
+> not allow nmbug tags with "::".  Since the check is done for all\r
+> tagging operations in Emacs UI, this basically means that no nmbug\r
+> tags can be changed.  The patch relaxes the tag syntax check to allow\r
+> any tag names that do not include whitespace characters.\r
+\r
+Imho the syntax check should be in cli, or lib even. I posted a patch to\r
+cli some time ago when I realized it's possible to add tag "-" but you\r
+can't remove it with the current cli. (On the road, can't find the message\r
+id now.)\r
+\r
+> ---\r
+>  emacs/notmuch.el |    2 +-\r
+>  1 files changed, 1 insertions(+), 1 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index 9813e0a..0de6123 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -555,7 +555,7 @@ notmuch-after-tag-hook will be run."\r
+>   ;; Perform some validation\r
+>   (when (null tags) (error "No tags given"))\r
+>   (mapc (lambda (tag)\r
+> -         (unless (string-match-p "^[-+][-+_.[:word:]]+$" tag)\r
+> +         (unless (string-match-p "^[-+]\\S-+$" tag)\r
+>            (error "Tag must be of the form `+this_tag' or `-that_tag'")))\r
+>        tags)\r
+>   (run-hooks 'notmuch-before-tag-hook)\r
+> --\r
+> 1.7.8.3\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--e89a8ff1c3e89240a304b792c9df\r
+Content-Type: text/html; charset=UTF-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+<p><br>\r
+On Jan 28, 2012 7:06 AM, &quot;Dmitry Kurochkin&quot; &lt;<a href=3D"mailto=\r
+:dmitry.kurochkin@gmail.com">dmitry.kurochkin@gmail.com</a>&gt; wrote:<br>\r
+&gt;<br>\r
+&gt; The tag syntax check in `notmuch-tag&#39; function was too strict and =\r
+did<br>\r
+&gt; not allow nmbug tags with &quot;::&quot;. =C2=A0Since the check is don=\r
+e for all<br>\r
+&gt; tagging operations in Emacs UI, this basically means that no nmbug<br>\r
+&gt; tags can be changed. =C2=A0The patch relaxes the tag syntax check to a=\r
+llow<br>\r
+&gt; any tag names that do not include whitespace characters.</p>\r
+<p>Imho the syntax check should be in cli, or lib even. I posted a patch to=\r
+ cli some time ago when I realized it&#39;s possible to add tag &quot;-&quo=\r
+t; but you can&#39;t remove it with the current cli. (On the road, can&#39;=\r
+t find the message id now.)<br>\r
+</p>\r
+<p>&gt; ---<br>\r
+&gt; =C2=A0emacs/notmuch.el | =C2=A0 =C2=A02 +-<br>\r
+&gt; =C2=A01 files changed, 1 insertions(+), 1 deletions(-)<br>\r
+&gt;<br>\r
+&gt; diff --git a/emacs/notmuch.el b/emacs/notmuch.el<br>\r
+&gt; index 9813e0a..0de6123 100644<br>\r
+&gt; --- a/emacs/notmuch.el<br>\r
+&gt; +++ b/emacs/notmuch.el<br>\r
+&gt; @@ -555,7 +555,7 @@ notmuch-after-tag-hook will be run.&quot;<br>\r
+&gt; =C2=A0 ;; Perform some validation<br>\r
+&gt; =C2=A0 (when (null tags) (error &quot;No tags given&quot;))<br>\r
+&gt; =C2=A0 (mapc (lambda (tag)<br>\r
+&gt; - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (string-match-p &quot;^[-+][-+_.=\r
+[:word:]]+$&quot; tag)<br>\r
+&gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (string-match-p &quot;^[-+]\\S-+=\r
+$&quot; tag)<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(error &quot;Tag must be of t=\r
+he form `+this_tag&#39; or `-that_tag&#39;&quot;)))<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0tags)<br>\r
+&gt; =C2=A0 (run-hooks &#39;notmuch-before-tag-hook)<br>\r
+&gt; --<br>\r
+&gt; 1.7.8.3<br>\r
+&gt;<br>\r
+&gt; _______________________________________________<br>\r
+&gt; notmuch mailing list<br>\r
+&gt; <a href=3D"mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a>=\r
+<br>\r
+&gt; <a href=3D"http://notmuchmail.org/mailman/listinfo/notmuch">http://not=\r
+muchmail.org/mailman/listinfo/notmuch</a><br>\r
+</p>\r
+\r
+--e89a8ff1c3e89240a304b792c9df--\r