]> git.eshelyaron.com Git - emacs.git/commitdiff
Stop signaling an error when reading "smart quotes" in symbols
authorNoam Postavsky <npostavs@gmail.com>
Sat, 10 Mar 2018 23:20:45 +0000 (18:20 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Thu, 28 Nov 2019 23:03:42 +0000 (18:03 -0500)
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
src/character.c
src/character.h
src/lread.c
src/print.c
test/src/lread-tests.el

index cb73e46358a7e68976888e0ef89cad082a4dea68..3a2efcfc2e0c89f7196f89230c158e21bf16c5d3 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2972,15 +2972,6 @@ and if the new behavior breaks your code please email
 <32252@debbugs.gnu.org>.  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
index 708eb2f70243d72797c5b870efe927ad9f51eb3a..55ad49005a0c791741e87f8898c02e06362eda61 100644 (file)
@@ -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] =
index 230fc6eab59e11b16d6a67a8e53cba5dd65301a4..3642a5404486800a4265d313db9209814e938fa3 100644 (file)
@@ -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)]))
index 4ea6202972768da6e24ceca018132bff5a20f55a..e5a9c93c55ee1be2a8e0f854cc138a2a3ecf4ce4 100644 (file)
@@ -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
index a2c199c14ad6462192b7df93a1098c4792e49462..7105c5dbb92bef489da879f1c1c831c2c5c925cd 100644 (file)
@@ -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;
index 3a2212ef7708c241ccb560cae9b24fa1d75040f1..0c14a1afdaab38000cd510633a0ba8a2e4541b47 100644 (file)
@@ -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