unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23867: 25.1.50; Doc string containing `\N'
@ 2016-06-29  9:44 Tino Calancha
  2016-06-29  9:52 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tino Calancha @ 2016-06-29  9:44 UTC (permalink / raw)
  To: 23867


After commit
de7d5f36e0f3261a7300fa3a3d87ae3b758b8a73
a doc string cannot contain `\N'.  It should be
written `\\N'.

For instance:
emacs -Q
;; create a file foo.el with contents:

(defun foo ()
   "Test characters allowed in doc strings.
The following char is not allowed: `\N'
You need to double the slash."
   (interactive)
   (message "Test for doc strings"))

;; Load the file:
;; invalid-read-syntax Expected opening brace after \N

I saw 3rd party code with doc strings containing `\N'.
Should that 3rd party code update to `\\N'?
Or is OK to allow doc strings with `\N'?


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/src/lread.c b/src/lread.c
index 5c47f78..7643d49 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2390,6 +2390,8 @@ read_escape (Lisp_Object readcharfun, bool stringp)
        /* Named character.  */
        {
          c = READCHAR;
+        if (c == '\'')
+          return c;
          if (c != '{')
            invalid_syntax ("Expected opening brace after \\N");
          char name[UNICODE_CHARACTER_NAME_LENGTH_BOUND + 1];


GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) of 
2016-06-29
Repository revision: 4a2a1eba09e5bbc37b853733708feae17f1425f5






^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29  9:44 bug#23867: 25.1.50; Doc string containing `\N' Tino Calancha
@ 2016-06-29  9:52 ` Andreas Schwab
  2016-06-29 10:01   ` Tino Calancha
  2016-07-04 16:43 ` Glenn Morris
  2016-07-06 14:56 ` Paul Eggert
  2 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2016-06-29  9:52 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 23867

Tino Calancha <tino.calancha@gmail.com> writes:

> After commit
> de7d5f36e0f3261a7300fa3a3d87ae3b758b8a73
> a doc string cannot contain `\N'.

Before that "\N" was the same as "N", so there is no point in writing
that.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29  9:52 ` Andreas Schwab
@ 2016-06-29 10:01   ` Tino Calancha
  2016-06-29 14:00     ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Tino Calancha @ 2016-06-29 10:01 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 23867, Tino Calancha



On Wed, 29 Jun 2016, Andreas Schwab wrote:

> Before that "\N" was the same as "N", so there is no point in writing
> that.
Good point.  Thank you.

Tino





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29 10:01   ` Tino Calancha
@ 2016-06-29 14:00     ` Drew Adams
  2016-06-29 14:15       ` Andreas Schwab
  2016-06-29 14:44       ` Noam Postavsky
  0 siblings, 2 replies; 9+ messages in thread
From: Drew Adams @ 2016-06-29 14:00 UTC (permalink / raw)
  To: Tino Calancha, Andreas Schwab; +Cc: 23867

> > Before that "\N" was the same as "N", so there is no point in writing
> > that.
>
> Good point.  Thank you.

It's a valid point, but it is also wrong.

There might be "no point in writing" \N, but there can be a use
for having \N act as N - as it always has.  Doc strings can be
produced by _code_, and that code can escape ordinary characters,
for which the escaping should be a no-op.

There have been very few exceptions to this in the past - very
few characters for which \-escaping is not a no-op.  What's the
rationale for breaking this for N?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29 14:00     ` Drew Adams
@ 2016-06-29 14:15       ` Andreas Schwab
  2016-06-29 14:44       ` Noam Postavsky
  1 sibling, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2016-06-29 14:15 UTC (permalink / raw)
  To: Drew Adams; +Cc: 23867, Tino Calancha

Drew Adams <drew.adams@oracle.com> writes:

> There have been very few exceptions to this in the past - very
> few characters for which \-escaping is not a no-op.  What's the
> rationale for breaking this for N?

The same as for `u' or `U' or ` ' or `x' (in reverse chronological
order).

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29 14:00     ` Drew Adams
  2016-06-29 14:15       ` Andreas Schwab
@ 2016-06-29 14:44       ` Noam Postavsky
  1 sibling, 0 replies; 9+ messages in thread
From: Noam Postavsky @ 2016-06-29 14:44 UTC (permalink / raw)
  To: Drew Adams; +Cc: Andreas Schwab, Tino Calancha, 23867

On Wed, Jun 29, 2016 at 10:00 AM, Drew Adams <drew.adams@oracle.com> wrote:
>
> There have been very few exceptions to this in the past - very
> few characters for which \-escaping is not a no-op.  What's the
> rationale for breaking this for N?

It's in NEWS:

** Emacs now supports character name escape sequences in character and
string literals.  The syntax variants \N{character name} and
\N{U+code} are supported.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29  9:44 bug#23867: 25.1.50; Doc string containing `\N' Tino Calancha
  2016-06-29  9:52 ` Andreas Schwab
@ 2016-07-04 16:43 ` Glenn Morris
  2016-07-06 14:56 ` Paul Eggert
  2 siblings, 0 replies; 9+ messages in thread
From: Glenn Morris @ 2016-07-04 16:43 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 23867

Tino Calancha wrote:

> ;; invalid-read-syntax Expected opening brace after \N

Is it too difficult for \N followed by anything other than { to be
treated (possibly with a warning?) as before (ie, not as an escape)?
Then cake can be had and eaten.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-06-29  9:44 bug#23867: 25.1.50; Doc string containing `\N' Tino Calancha
  2016-06-29  9:52 ` Andreas Schwab
  2016-07-04 16:43 ` Glenn Morris
@ 2016-07-06 14:56 ` Paul Eggert
  2016-07-06 15:35   ` Glenn Morris
  2 siblings, 1 reply; 9+ messages in thread
From: Paul Eggert @ 2016-07-06 14:56 UTC (permalink / raw)
  To: 23867

> Is it too difficult for \N followed by anything other than { to be
> treated (possibly with a warning?) as before (ie, not as an escape)?

It could be done, but I'd rather not. lread.c doesn't warn about other 
stuff, by and large, and any warnings are likely to be ignored anyway. 
It would be additional complexity for very little benefit.

As a general rule Elisp code should not use \X unless \X is documented 
to be part of an escape sequence, or X is an ASCII punctuation character 
that might otherwise confuse Emacs. (By the way, are the punctuation 
characters still an issue? I've forgotten what their problem was or is.)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23867: 25.1.50; Doc string containing `\N'
  2016-07-06 14:56 ` Paul Eggert
@ 2016-07-06 15:35   ` Glenn Morris
  0 siblings, 0 replies; 9+ messages in thread
From: Glenn Morris @ 2016-07-06 15:35 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 23867

Paul Eggert wrote:

>> Is it too difficult for \N followed by anything other than { to be
>> treated (possibly with a warning?) as before (ie, not as an escape)?
>
> It could be done, but I'd rather not. lread.c doesn't warn about other
> stuff, by and large, and any warnings are likely to be ignored anyway.
> It would be additional complexity for very little benefit.

Fair enough.
I will close this report then.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-06 15:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-29  9:44 bug#23867: 25.1.50; Doc string containing `\N' Tino Calancha
2016-06-29  9:52 ` Andreas Schwab
2016-06-29 10:01   ` Tino Calancha
2016-06-29 14:00     ` Drew Adams
2016-06-29 14:15       ` Andreas Schwab
2016-06-29 14:44       ` Noam Postavsky
2016-07-04 16:43 ` Glenn Morris
2016-07-06 14:56 ` Paul Eggert
2016-07-06 15:35   ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).