From 2518bc249c7962ab0e2272f591fce63495d793b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Mon, 17 Oct 2022 15:24:21 +0200 Subject: [PATCH] Fix printing symbols --- src/print.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/print.c b/src/print.c index 69b82659b3e..52a86ebf15b 100644 --- a/src/print.c +++ b/src/print.c @@ -2167,10 +2167,8 @@ static bool must_escape_p (int c, int ichar) { if (c == '\"' || c == '\\' || c == '\'' - || (ichar == 0 - && (c == '+' || c == '-' || c == '?' || c == '.')) || c == ';' || c == '#' || c == '(' || c == ')' - || c == ',' || c == '`' || c == '|' + || c == ',' || c == '`' || c == ':' || c == '[' || c == ']' || c <= 040 || c == NO_BREAK_SPACE) return true; @@ -2185,9 +2183,13 @@ looks_like_number_p (Lisp_Object name) const char *p = (const char *) SDATA (name); const bool signedp = *p == '-' || *p == '+'; ptrdiff_t len; - return ((c_isdigit (p[signedp]) || p[signedp] == '.') + return (((c_isdigit (p[signedp]) || p[signedp] == '.') && !NILP (string_to_number (p, 10, &len)) - && len == SBYTES (name)); + && len == SBYTES (name)) + /* We don't escape "." or "?" (unless they're the first + character in the symbol name). */ + || *p == '?' + || *p == '.'); } /* Print string NAME like a symbol name. */ -- 2.39.2