Fix round tripping of read->print for symbols with strange quotes
commit36c8128e740ce91af10769bef46a21a72dafc56c
authorNoam Postavsky <npostavs@gmail.com>
Tue, 23 Jan 2018 23:50:23 +0000 (23 18:50 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 28 Jan 2018 15:43:01 +0000 (28 10:43 -0500)
tree19a2dd3106c0e65b2e12cb4f7e542f6d9e9d2aa1
parent69a30e8b87fac5888daa26c63663351570e3d533
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).
etc/NEWS
etc/NEWS.26
src/character.c
src/character.h
src/lread.c
src/print.c
test/src/print-tests.el