bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20852: 24.3; update-file-autoloads doesn't accept unescaped parenthe


From: Stefan Monnier
Subject: bug#20852: 24.3; update-file-autoloads doesn't accept unescaped parenthesis character literal
Date: Thu, 02 Jul 2015 11:50:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> I've attached a patch that uses the same mechanism as the check for
> old-style backquotes.

Looks pretty good, thank you.
A few comments and nitpicks:

> +static void
> +load_warn_unescaped_character_literals (Lisp_Object file) {
> +  if (!NILP (Vunescaped_character_literals))
> +    {
> +      AUTO_STRING (format, "Loading `%s': unescaped parenthesis character 
> literals detected!");
> +      CALLN (Fmessage, format, file);
> +    }
> +}

It would be even better to show the actual unescaped character literal(s).
Either just displaying one of the chars, or displaying them all.

>       if (c == ' ' || c == '\t')
>         return make_number (c);
> 
> +     if (c == '(' || c == ')')
> +       Vunescaped_character_literals = Qt;

I think we want to emit the same warning for several other chars, at
least ';', '"', '[', and ']' (we could also include ' ' and '\t', tho
I'm not sure it's worth the trouble.  If/when we want to do that, we'd
want to do it not just for ?<SPC> and ?<TAB> but also for ?\<SPC>
and ?\<TAB> and recommend the use of ?\s and ?\t instead).

>    DEFSYM (Qold_style_backquotes, "old-style-backquotes");
> +  DEFSYM (Qunescaped_character_literals, "unescaped-character-literals");

I think "old-style-backquotes" was a bad choice.  It should have been
"read--found-old-style-backquotes" or something along these lines.
AFAIK this variable is only used internally, so we can rename it without
any extra precautions.  If you could do that in your patch, that'd
be great.

One more thing: old-style-backquotes is not only used by `load' but also
by the byte-compiler.  So take a look at bytecomp.el where you'll
probably want to add similar code for your unescaped-character-literals.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]