diff options
author | Noam Postavsky <npostavs@gmail.com> | 2018-01-23 18:50:23 -0500 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2018-01-28 10:43:01 -0500 |
commit | 36c8128e740ce91af10769bef46a21a72dafc56c (patch) | |
tree | 19a2dd3106c0e65b2e12cb4f7e542f6d9e9d2aa1 /src/print.c | |
parent | 69a30e8b87fac5888daa26c63663351570e3d533 (diff) | |
download | emacs-36c8128e740ce91af10769bef46a21a72dafc56c.tar.gz emacs-36c8128e740ce91af10769bef46a21a72dafc56c.tar.bz2 emacs-36c8128e740ce91af10769bef46a21a72dafc56c.zip |
Fix round tripping of read->print for symbols with strange quotes
Since 2017-07-22 "Signal error for symbol names with strange
quotes (Bug#2967)", symbol names beginning with certain quote
characters require an escaping backslash. However, the corresponding
change for printing missed, so that (eq (read (prin1-to-string SYM))
SYM) does not give `t' for such symbols.
* src/character.c (confusable_symbol_character_p): New function,
extracted from test `read1'.
* src/lread.c (read1): Use it.
* src/print.c (print_object): Use it to print a backslash for symbols
starting with characters that `read1' requires to be escaped.
* test/src/print-tests.el (print-read-roundtrip): New test.
* etc/NEWS.26:
* etc/NEWS: Clarify the announcement for the earlier reader
change (Bug#30217).
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/print.c b/src/print.c index 0e1980d84be..71579673248 100644 --- a/src/print.c +++ b/src/print.c @@ -1971,7 +1971,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) || c == ';' || c == '#' || c == '(' || c == ')' || c == ',' || c == '.' || c == '`' || c == '[' || c == ']' || c == '?' || c <= 040 - || confusing) + || confusing + || (i == 1 && confusable_symbol_character_p (c))) { printchar ('\\', printcharfun); confusing = false; |