** 'print-quoted' now defaults to t, so if you want to see
(quote x) instead of 'x you will have to bind it to nil where applicable.
+** 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")
+
** Internal parsing commands now use syntax-ppss and disregard
open-paren-in-column-0-is-defun-start. This affects mostly things like
forward-comment, scan-sexps, and forward-sexp when parsing backward.
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'
return XINT (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;
+ }
+}
+
signed char HEXDIGIT_CONST hexdigit[UCHAR_MAX + 1] =
{
#if HEXDIGIT_IS_CONST
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)]))
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)));
- }
+ if (confusable_symbol_character_p (ch))
+ xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"),
+ CALLN (Fstring, make_number (ch)));
}
{
Lisp_Object result;
|| c == ';' || c == '#' || c == '(' || c == ')'
|| c == ',' || c == '.' || c == '`'
|| c == '[' || c == ']' || c == '?' || c <= 040
- || confusing)
+ || confusing
+ || (i == 1 && confusable_symbol_character_p (c)))
{
printchar ('\\', printcharfun);
confusing = false;
(buffer-string))
"--------\n"))))
+(ert-deftest print-read-roundtrip ()
+ (let ((sym '\’bar))
+ (should (eq (read (prin1-to-string sym)) sym))))
+
(provide 'print-tests)
;;; print-tests.el ends here