diff options
| author | Noam Postavsky | 2018-01-28 10:23:18 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2018-01-28 10:49:51 -0500 |
| commit | 0510a78da5faaa40ebfdf59d0ac6107a72c1be1d (patch) | |
| tree | 1fd0abd958f1f31e200b5f2aac8fe97ceb88a2a2 | |
| parent | 6415b2d40c13be2c5cd5f797718c391d1c4ce9e6 (diff) | |
| download | emacs-0510a78da5faaa40ebfdf59d0ac6107a72c1be1d.tar.gz emacs-0510a78da5faaa40ebfdf59d0ac6107a72c1be1d.zip | |
Revert "Signal error for symbol names with strange quotes (Bug#2967)"
That commit did not make the corresponding change to printing, thus
breaking the (eq (read (prin1-to-string SYM)) SYM) invariant for those
symbols. It's too late in the release cycle to change printing
behavior, therefore revert the reader change.
Don't merge to master, the print function will be updated there (see
"Fix round tripping of read->print for symbols with strange quotes").
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | src/lread.c | 18 | ||||
| -rw-r--r-- | test/src/lread-tests.el | 17 |
3 files changed, 0 insertions, 40 deletions
| @@ -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' |
diff --git a/src/lread.c b/src/lread.c index 45d60647bee..3104c441ecf 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3479,24 +3479,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3479 | if (! NILP (result)) | 3479 | if (! NILP (result)) |
| 3480 | return unbind_to (count, result); | 3480 | return unbind_to (count, result); |
| 3481 | } | 3481 | } |
| 3482 | if (!quoted && multibyte) | ||
| 3483 | { | ||
| 3484 | int ch = STRING_CHAR ((unsigned char *) read_buffer); | ||
| 3485 | switch (ch) | ||
| 3486 | { | ||
| 3487 | case 0x2018: /* LEFT SINGLE QUOTATION MARK */ | ||
| 3488 | case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ | ||
| 3489 | case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ | ||
| 3490 | case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ | ||
| 3491 | case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ | ||
| 3492 | case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ | ||
| 3493 | case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ | ||
| 3494 | case 0xFF02: /* FULLWIDTH QUOTATION MARK */ | ||
| 3495 | case 0xFF07: /* FULLWIDTH APOSTROPHE */ | ||
| 3496 | xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"), | ||
| 3497 | CALLN (Fstring, make_number (ch))); | ||
| 3498 | } | ||
| 3499 | } | ||
| 3500 | { | 3482 | { |
| 3501 | Lisp_Object result; | 3483 | Lisp_Object result; |
| 3502 | ptrdiff_t nbytes = p - read_buffer; | 3484 | ptrdiff_t nbytes = p - read_buffer; |
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 4fec9286e45..5c3fea7e680 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -142,23 +142,6 @@ literals (Bug#20852)." | |||
| 142 | "unescaped character literals " | 142 | "unescaped character literals " |
| 143 | "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) | 143 | "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) |
| 144 | 144 | ||
| 145 | (ert-deftest lread-tests--funny-quote-symbols () | ||
| 146 | "Check that 'smart quotes' or similar trigger errors in symbol names." | ||
| 147 | (dolist (quote-char | ||
| 148 | '(#x2018 ;; LEFT SINGLE QUOTATION MARK | ||
| 149 | #x2019 ;; RIGHT SINGLE QUOTATION MARK | ||
| 150 | #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK | ||
| 151 | #x201C ;; LEFT DOUBLE QUOTATION MARK | ||
| 152 | #x201D ;; RIGHT DOUBLE QUOTATION MARK | ||
| 153 | #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK | ||
| 154 | #x301E ;; DOUBLE PRIME QUOTATION MARK | ||
| 155 | #xFF02 ;; FULLWIDTH QUOTATION MARK | ||
| 156 | #xFF07 ;; FULLWIDTH APOSTROPHE | ||
| 157 | )) | ||
| 158 | (let ((str (format "%cfoo" quote-char))) | ||
| 159 | (should-error (read str) :type 'invalid-read-syntax) | ||
| 160 | (should (eq (read (concat "\\" str)) (intern str)))))) | ||
| 161 | |||
| 162 | (ert-deftest lread-test-bug26837 () | 145 | (ert-deftest lread-test-bug26837 () |
| 163 | "Test for https://debbugs.gnu.org/26837 ." | 146 | "Test for https://debbugs.gnu.org/26837 ." |
| 164 | (let ((load-path (cons | 147 | (let ((load-path (cons |