diff options
| author | Noam Postavsky | 2018-01-23 18:50:23 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2018-01-28 10:43:01 -0500 |
| commit | 36c8128e740ce91af10769bef46a21a72dafc56c (patch) | |
| tree | 19a2dd3106c0e65b2e12cb4f7e542f6d9e9d2aa1 /etc | |
| parent | 69a30e8b87fac5888daa26c63663351570e3d533 (diff) | |
| download | emacs-36c8128e740ce91af10769bef46a21a72dafc56c.tar.gz 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 'etc')
| -rw-r--r-- | etc/NEWS | 9 | ||||
| -rw-r--r-- | etc/NEWS.26 | 5 |
2 files changed, 9 insertions, 5 deletions
| @@ -229,6 +229,15 @@ as new-style, bind the new variable 'force-new-style-backquotes' to t. | |||
| 229 | ** 'print-quoted' now defaults to t, so if you want to see | 229 | ** 'print-quoted' now defaults to t, so if you want to see |
| 230 | (quote x) instead of 'x you will have to bind it to nil where applicable. | 230 | (quote x) instead of 'x you will have to bind it to nil where applicable. |
| 231 | 231 | ||
| 232 | ** To avoid confusion caused by "smart quotes", the reader signals an | ||
| 233 | error when reading Lisp symbols which begin with one of the following | ||
| 234 | quotation characters: ‘’‛“”‟〞"'. A symbol beginning with such a | ||
| 235 | character can be written by escaping the quotation character with a | ||
| 236 | backslash. For example: | ||
| 237 | |||
| 238 | (read "‘smart") => (invalid-read-syntax "strange quote" "‘") | ||
| 239 | (read "\\‘smart") == (intern "‘smart") | ||
| 240 | |||
| 232 | ** Internal parsing commands now use syntax-ppss and disregard | 241 | ** Internal parsing commands now use syntax-ppss and disregard |
| 233 | open-paren-in-column-0-is-defun-start. This affects mostly things like | 242 | open-paren-in-column-0-is-defun-start. This affects mostly things like |
| 234 | forward-comment, scan-sexps, and forward-sexp when parsing backward. | 243 | forward-comment, scan-sexps, and forward-sexp when parsing backward. |
diff --git a/etc/NEWS.26 b/etc/NEWS.26 index 46762d65e18..76e6316ca2e 100644 --- a/etc/NEWS.26 +++ b/etc/NEWS.26 | |||
| @@ -1377,11 +1377,6 @@ second argument instead of its first. | |||
| 1377 | renamed to 'lread--old-style-backquotes'. No user code should use | 1377 | renamed to 'lread--old-style-backquotes'. No user code should use |
| 1378 | this variable. | 1378 | this variable. |
| 1379 | 1379 | ||
| 1380 | --- | ||
| 1381 | ** To avoid confusion caused by "smart quotes", the reader no longer | ||
| 1382 | accepts Lisp symbols which begin with the following quotation | ||
| 1383 | characters: ‘’‛“”‟〞"', unless they are escaped with backslash. | ||
| 1384 | |||
| 1385 | +++ | 1380 | +++ |
| 1386 | ** 'default-file-name-coding-system' now defaults to a coding system | 1381 | ** 'default-file-name-coding-system' now defaults to a coding system |
| 1387 | that does not process CRLF. For example, it defaults to 'utf-8-unix' | 1382 | that does not process CRLF. For example, it defaults to 'utf-8-unix' |