diff options
| author | Noam Postavsky | 2018-03-10 18:20:45 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2019-11-28 18:03:42 -0500 |
| commit | 85f586f3ce5c6d9598d345440fd57e0fc9b8d98b (patch) | |
| tree | 10723ac9f3d20dc4a4bb045b1e58c02234a9c9e5 /src | |
| parent | 98f8c5fb07dcb4e20b8ba6648bdabf5c0d3b5145 (diff) | |
| download | emacs-85f586f3ce5c6d9598d345440fd57e0fc9b8d98b.tar.gz emacs-85f586f3ce5c6d9598d345440fd57e0fc9b8d98b.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/character.c | 26 | ||||
| -rw-r--r-- | src/character.h | 2 | ||||
| -rw-r--r-- | src/lread.c | 7 | ||||
| -rw-r--r-- | src/print.c | 3 |
4 files changed, 1 insertions, 37 deletions
diff --git a/src/character.c b/src/character.c index 708eb2f7024..55ad49005a0 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -1056,32 +1056,6 @@ blankp (int c) | |||
| 1056 | return XFIXNUM (category) == UNICODE_CATEGORY_Zs; /* separator, space */ | 1056 | return XFIXNUM (category) == UNICODE_CATEGORY_Zs; /* separator, space */ |
| 1057 | } | 1057 | } |
| 1058 | 1058 | ||
| 1059 | |||
| 1060 | /* Return true for characters that would read as symbol characters, | ||
| 1061 | but graphically may be confused with some kind of punctuation. We | ||
| 1062 | require an escaping backslash, when such characters begin a | ||
| 1063 | symbol. */ | ||
| 1064 | bool | ||
| 1065 | confusable_symbol_character_p (int ch) | ||
| 1066 | { | ||
| 1067 | switch (ch) | ||
| 1068 | { | ||
| 1069 | case 0x2018: /* LEFT SINGLE QUOTATION MARK */ | ||
| 1070 | case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ | ||
| 1071 | case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ | ||
| 1072 | case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ | ||
| 1073 | case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ | ||
| 1074 | case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ | ||
| 1075 | case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ | ||
| 1076 | case 0xFF02: /* FULLWIDTH QUOTATION MARK */ | ||
| 1077 | case 0xFF07: /* FULLWIDTH APOSTROPHE */ | ||
| 1078 | return true; | ||
| 1079 | |||
| 1080 | default: | ||
| 1081 | return false; | ||
| 1082 | } | ||
| 1083 | } | ||
| 1084 | |||
| 1085 | /* hexdigit[C] is one greater than C's numeric value if C is a | 1059 | /* hexdigit[C] is one greater than C's numeric value if C is a |
| 1086 | hexadecimal digit, zero otherwise. */ | 1060 | hexadecimal digit, zero otherwise. */ |
| 1087 | signed char const hexdigit[UCHAR_MAX + 1] = | 1061 | signed char const hexdigit[UCHAR_MAX + 1] = |
diff --git a/src/character.h b/src/character.h index 230fc6eab59..3642a540448 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -684,8 +684,6 @@ extern bool graphicp (int); | |||
| 684 | extern bool printablep (int); | 684 | extern bool printablep (int); |
| 685 | extern bool blankp (int); | 685 | extern bool blankp (int); |
| 686 | 686 | ||
| 687 | extern bool confusable_symbol_character_p (int ch); | ||
| 688 | |||
| 689 | /* Return a translation table of id number ID. */ | 687 | /* Return a translation table of id number ID. */ |
| 690 | #define GET_TRANSLATION_TABLE(id) \ | 688 | #define GET_TRANSLATION_TABLE(id) \ |
| 691 | (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) | 689 | (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) |
diff --git a/src/lread.c b/src/lread.c index 4ea62029727..e5a9c93c55e 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3571,13 +3571,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3571 | if (! NILP (result) && len == nbytes) | 3571 | if (! NILP (result) && len == nbytes) |
| 3572 | return unbind_to (count, result); | 3572 | return unbind_to (count, result); |
| 3573 | } | 3573 | } |
| 3574 | if (!quoted && multibyte) | ||
| 3575 | { | ||
| 3576 | int ch = STRING_CHAR ((unsigned char *) read_buffer); | ||
| 3577 | if (confusable_symbol_character_p (ch)) | ||
| 3578 | xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"), | ||
| 3579 | CALLN (Fstring, make_fixnum (ch))); | ||
| 3580 | } | ||
| 3581 | { | 3574 | { |
| 3582 | Lisp_Object result; | 3575 | Lisp_Object result; |
| 3583 | ptrdiff_t nchars | 3576 | ptrdiff_t nchars |
diff --git a/src/print.c b/src/print.c index a2c199c14ad..7105c5dbb92 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -2035,8 +2035,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 2035 | || c == ',' || c == '.' || c == '`' | 2035 | || c == ',' || c == '.' || c == '`' |
| 2036 | || c == '[' || c == ']' || c == '?' || c <= 040 | 2036 | || c == '[' || c == ']' || c == '?' || c <= 040 |
| 2037 | || c == NO_BREAK_SPACE | 2037 | || c == NO_BREAK_SPACE |
| 2038 | || confusing | 2038 | || confusing) |
| 2039 | || (i == 1 && confusable_symbol_character_p (c))) | ||
| 2040 | { | 2039 | { |
| 2041 | printchar ('\\', printcharfun); | 2040 | printchar ('\\', printcharfun); |
| 2042 | confusing = false; | 2041 | confusing = false; |