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


+On Jan 28, 2012 7:06 AM, "Dmitry Kurochkin" <dmitry.kurochkin@gmail.com> wrote:
+>
+> The tag syntax check in `notmuch-tag' function was too strict and = +did
+> not allow nmbug tags with "::". =C2=A0Since the check is don= +e for all
+> tagging operations in Emacs UI, this basically means that no nmbug
+> tags can be changed. =C2=A0The patch relaxes the tag syntax check to a= +llow
+> any tag names that do not include whitespace characters.

+

Imho the syntax check should be in cli, or lib even. I posted a patch to= + cli some time ago when I realized it's possible to add tag "-&quo= +t; but you can't remove it with the current cli. (On the road, can'= +t find the message id now.)
+

+

> ---
+> =C2=A0emacs/notmuch.el | =C2=A0 =C2=A02 +-
+> =C2=A01 files changed, 1 insertions(+), 1 deletions(-)
+>
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
+> index 9813e0a..0de6123 100644
+> --- a/emacs/notmuch.el
+> +++ b/emacs/notmuch.el
+> @@ -555,7 +555,7 @@ notmuch-after-tag-hook will be run."
+> =C2=A0 ;; Perform some validation
+> =C2=A0 (when (null tags) (error "No tags given"))
+> =C2=A0 (mapc (lambda (tag)
+> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (string-match-p "^[-+][-+_.= +[:word:]]+$" tag)
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (string-match-p "^[-+]\\S-+= +$" tag)
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(error "Tag must be of t= +he form `+this_tag' or `-that_tag'")))
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0tags)
+> =C2=A0 (run-hooks 'notmuch-before-tag-hook)
+> --
+> 1.7.8.3
+>
+> _______________________________________________
+> notmuch mailing list
+> notmuch@notmuchmail.org= +
+> http://not= +muchmail.org/mailman/listinfo/notmuch
+

+ +--e89a8ff1c3e89240a304b792c9df--