diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-03-14 10:27:12 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-03-14 10:29:54 +0100 |
commit | 637dde4aba921435f78d0de769ad74c4f3230aa6 (patch) | |
tree | f6057e5d04746c63a74ab925108432fe7df52d42 /src | |
parent | 15c61cb359bc0021f14fbcc5a2e0eb71fe0261ab (diff) | |
download | emacs-637dde4aba921435f78d0de769ad74c4f3230aa6.tar.gz |
Don't always escape "." and "?" in `prin1'
* src/print.c (print_object): Only escape "." and "?" when
appearing as the first character in a symbol (bug#23130).
Diffstat (limited to 'src')
-rw-r--r-- | src/print.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/print.c b/src/print.c index 8cce8a1ad83..704fc278f2d 100644 --- a/src/print.c +++ b/src/print.c @@ -2171,14 +2171,19 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) Lisp_Object name = SYMBOL_NAME (obj); ptrdiff_t size_byte = SBYTES (name); - /* Set CONFUSING if NAME looks like a number, calling - string_to_number for non-obvious cases. */ char *p = SSDATA (name); bool signedp = *p == '-' || *p == '+'; ptrdiff_t len; - bool confusing = ((c_isdigit (p[signedp]) || p[signedp] == '.') - && !NILP (string_to_number (p, 10, &len)) - && len == size_byte); + bool confusing = + /* Set CONFUSING if NAME looks like a number, calling + string_to_number for non-obvious cases. */ + ((c_isdigit (p[signedp]) || p[signedp] == '.') + && !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). */ + || *p == '?' + || *p == '.'; if (! NILP (Vprint_gensym) && !SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (obj)) @@ -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) { |