GNU bug report logs - #77656
[PATCH] Don't escape "." in `prin1' unless followed by "?" or nothing

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 8 Apr 2025 21:43:02 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 77656 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: larsi <at> gnus.org, Eli Zaretskii <eliz <at> gnu.org>,
 Andrea Corallo <acorallo <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 77656 <at> debbugs.gnu.org
Subject: Re: bug#77656: [PATCH] Don't escape "." in `prin1' unless followed
 by "?" or nothing
Date: Tue, 15 Apr 2025 11:48:00 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>>> This is a followup to 637dde4aba921435f78d0de769ad74c4f3230aa6, which
>>>> removed some unnecessary escaping of "." and "?" when printing symbols
>>>> in prin1.
>>>>
>>>> This change removes more unnecessary escaping of "."; "." only
>>>> needs to be escaped when it's the entire symbol or if it's
>>>> followed by a "?".
>>>>
>>>> (Actually, if we always escaped "?" (which was the case before
>>>> 637dde4aba92) then "." only ever needs to be escaped when
>>>> string_to_number returns non-nil.  So 637dde4aba92 could have
>>>> just dropped the escaping of "." with no other changes, if it
>>>> didn't also remove escaping of "?")
>>>
>>> Any objections or comments, anyone?
>
> No real objection, but I'm a bit worried that it seems this is designed
> based on the idea that `prin1` should be `read`able by the same Emacs
> that printed it, whereas I think it should aim to generate output
> that's `read`able also by past and future Emacsen and that it shouldn't
> unduly restrict future changes to our lexical rules.
>
> I *think* the proposed change is OK in this respect, but at the same
> time I wonder if the gain is really worth the risk.

Yes, to be clear I think (though I haven't tested on truly ancient
Emacsen) that this is readable by all past versions of Emacs so it's
good in that department.

As for future Emacsen, I contend that we won't want to change how this
lexes in the future - it would break let-alist, for one thing.

Incidentally, making it easier to work with let-alist was one of my main
motivations for this change, since it ubiquitously uses symbols which
start with ".".




This bug report was last modified 21 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.