[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 85f586f 1/2: Stop signaling an error when reading "smart quotes"
From: |
Noam Postavsky |
Subject: |
master 85f586f 1/2: Stop signaling an error when reading "smart quotes" in symbols |
Date: |
Thu, 28 Nov 2019 18:24:39 -0500 (EST) |
branch: master
commit 85f586f3ce5c6d9598d345440fd57e0fc9b8d98b
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Stop signaling an error when reading "smart quotes" in symbols
Revert commits from 2018-01-28 "Fix round tripping of read->print for
symbols with strange quotes", and 2017-07-22 "Signal error for symbol
names with strange quotes (Bug#2967)".
* etc/NEWS: Remove corresponding entries.
* src/character.c (confusable_symbol_character_p):
* test/src/lread-tests.el (lread-tests--old-style-backquotes): Remove.
* src/lread.c (read1): Don't signal error on confusable character.
* src/print.c (print_object): Don't escape confusable characters.
---
etc/NEWS | 9 ---------
src/character.c | 26 --------------------------
src/character.h | 2 --
src/lread.c | 7 -------
src/print.c | 3 +--
test/src/lread-tests.el | 17 -----------------
6 files changed, 1 insertion(+), 63 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index cb73e46..3a2efcf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2972,15 +2972,6 @@ and if the new behavior breaks your code please email
<address@hidden>. Because '%o' and '%x' can now format signed
integers, they now support the '+' and space flags.
-** To avoid confusion caused by "smart quotes", the reader signals an
-error when reading Lisp symbols which begin with one of the following
-quotation characters: ‘’‛“”‟〞"'. A symbol beginning with such a
-character can be written by escaping the quotation character with a
-backslash. For example:
-
- (read "‘smart") => (invalid-read-syntax "strange quote" "‘")
- (read "\\‘smart") == (intern "‘smart")
-
+++
** Omitting variables after '&optional' and '&rest' is now allowed.
For example '(defun foo (&optional))' is no longer an error. This is
diff --git a/src/character.c b/src/character.c
index 708eb2f..55ad490 100644
--- a/src/character.c
+++ b/src/character.c
@@ -1056,32 +1056,6 @@ blankp (int c)
return XFIXNUM (category) == UNICODE_CATEGORY_Zs; /* separator, space */
}
-
-/* Return true for characters that would read as symbol characters,
- but graphically may be confused with some kind of punctuation. We
- require an escaping backslash, when such characters begin a
- symbol. */
-bool
-confusable_symbol_character_p (int ch)
-{
- 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 */
- return true;
-
- default:
- return false;
- }
-}
-
/* hexdigit[C] is one greater than C's numeric value if C is a
hexadecimal digit, zero otherwise. */
signed char const hexdigit[UCHAR_MAX + 1] =
diff --git a/src/character.h b/src/character.h
index 230fc6e..3642a54 100644
--- a/src/character.h
+++ b/src/character.h
@@ -684,8 +684,6 @@ extern bool graphicp (int);
extern bool printablep (int);
extern bool blankp (int);
-extern bool confusable_symbol_character_p (int ch);
-
/* Return a translation table of id number ID. */
#define GET_TRANSLATION_TABLE(id) \
(XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)]))
diff --git a/src/lread.c b/src/lread.c
index 4ea6202..e5a9c93 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3571,13 +3571,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
if (! NILP (result) && len == nbytes)
return unbind_to (count, result);
}
- if (!quoted && multibyte)
- {
- int ch = STRING_CHAR ((unsigned char *) read_buffer);
- if (confusable_symbol_character_p (ch))
- xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"),
- CALLN (Fstring, make_fixnum (ch)));
- }
{
Lisp_Object result;
ptrdiff_t nchars
diff --git a/src/print.c b/src/print.c
index a2c199c..7105c5d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2035,8 +2035,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun,
bool escapeflag)
|| c == ',' || c == '.' || c == '`'
|| c == '[' || c == ']' || c == '?' || c <= 040
|| c == NO_BREAK_SPACE
- || confusing
- || (i == 1 && confusable_symbol_character_p (c)))
+ || confusing)
{
printchar ('\\', printcharfun);
confusing = false;
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 3a2212e..0c14a1a 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -144,23 +144,6 @@ literals (Bug#20852)."
"`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', `?\\]' "
"expected!")))))
-(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