• Noam Postavsky's avatar
    Fix round tripping of read->print for symbols with strange quotes · 36c8128e
    Noam Postavsky authored
    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).
    36c8128e
character.c 31.4 KB