From 0510a78da5faaa40ebfdf59d0ac6107a72c1be1d Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 28 Jan 2018 10:23:18 -0500 Subject: [PATCH] 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"). --- etc/NEWS | 5 ----- src/lread.c | 18 ------------------ test/src/lread-tests.el | 17 ----------------- 3 files changed, 40 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 46762d65e18..76e6316ca2e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1377,11 +1377,6 @@ second argument instead of its first. renamed to 'lread--old-style-backquotes'. No user code should use this variable. ---- -** To avoid confusion caused by "smart quotes", the reader no longer -accepts Lisp symbols which begin with the following quotation -characters: ‘’‛“”‟〞"', unless they are escaped with backslash. - +++ ** 'default-file-name-coding-system' now defaults to a coding system 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) if (! NILP (result)) return unbind_to (count, result); } - if (!quoted && multibyte) - { - int ch = STRING_CHAR ((unsigned char *) read_buffer); - switch (ch) - { - case 0x2018: /* LEFT SINGLE QUOTATION MARK */ - case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ - case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ - case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ - case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ - case 0xFF02: /* FULLWIDTH QUOTATION MARK */ - case 0xFF07: /* FULLWIDTH APOSTROPHE */ - xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"), - CALLN (Fstring, make_number (ch))); - } - } { Lisp_Object result; 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)." "unescaped character literals " "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) -(ert-deftest lread-tests--funny-quote-symbols () - "Check that 'smart quotes' or similar trigger errors in symbol names." - (dolist (quote-char - '(#x2018 ;; LEFT SINGLE QUOTATION MARK - #x2019 ;; RIGHT SINGLE QUOTATION MARK - #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK - #x201C ;; LEFT DOUBLE QUOTATION MARK - #x201D ;; RIGHT DOUBLE QUOTATION MARK - #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK - #x301E ;; DOUBLE PRIME QUOTATION MARK - #xFF02 ;; FULLWIDTH QUOTATION MARK - #xFF07 ;; FULLWIDTH APOSTROPHE - )) - (let ((str (format "%cfoo" quote-char))) - (should-error (read str) :type 'invalid-read-syntax) - (should (eq (read (concat "\\" str)) (intern str)))))) - (ert-deftest lread-test-bug26837 () "Test for https://debbugs.gnu.org/26837 ." (let ((load-path (cons -- 2.39.2