[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dialling down symbol escaping slightly?
From: |
Lars Ingebrigtsen |
Subject: |
Re: Dialling down symbol escaping slightly? |
Date: |
Fri, 11 Mar 2022 04:44:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Or rather -- that's what I was kind of asking -- whether doing what I
> described would break the Lisp reader in any way. I don't think so, but
> there may be cases I'm not aware of.
There was the `.?' case, so it's not just `.'. So how about the
following -- it's more conservative than originally proposed, and leaves
open the possibility of introducing other future syntaxes starting with
a dot.
diff --git a/src/print.c b/src/print.c
index 8cce8a1ad8..3ede628b09 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2180,6 +2180,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun,
bool escapeflag)
&& !NILP (string_to_number (p, 10, &len))
&& len == size_byte);
+ /* We don't escape "." or "?" (unless they're the first
+ character in the symbol name). */
+ if (*p == '?' || *p == '.')
+ confusing = true;
+
if (! NILP (Vprint_gensym)
&& !SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (obj))
print_c_string ("#:", printcharfun);
@@ -2201,8 +2206,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun,
bool escapeflag)
{
if (c == '\"' || c == '\\' || c == '\''
|| c == ';' || c == '#' || c == '(' || c == ')'
- || c == ',' || c == '.' || c == '`'
- || c == '[' || c == ']' || c == '?' || c <= 040
+ || c == ',' || c == '`'
+ || c == '[' || c == ']' || c <= 040
|| c == NO_BREAK_SPACE
|| confusing)
{
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no