\f
* Incompatible Lisp Changes in Emacs 29.1
+---
+** 'prin1' doesn't always escape "." and "?" in symbols any more.
+Previously, symbols like 'foo.bar' would be printed by 'prin1' as
+"foo\.bar". This now prints as "foo.bar" instead. The Emacs Lisp
+reader interprets these strings as referring to the same symbol, so
+this is virtually always backwards-compatible, but there may
+theoretically be code out there that expects a specific printed
+representation.
+
+The same is the case with the "?" character: The 'foo?' symbol is now
+printed as "foo?" instead of "foo\?".
+
+If the "." and "?" characters are the first character in the symbol,
+they will still be escaped, so the '.foo' symbol is still printed as
+"\.foo" and the '?bar' symbol is still printed as "\?bar".
+
+++
** Remapping 'mode-line' no longer works as expected.
'mode-line' is now the parent face of the new 'mode-line-active' face,
Lisp_Object name = SYMBOL_NAME (obj);
ptrdiff_t size_byte = SBYTES (name);
- /* Set CONFUSING if NAME looks like a number, calling
- string_to_number for non-obvious cases. */
char *p = SSDATA (name);
bool signedp = *p == '-' || *p == '+';
ptrdiff_t len;
- bool confusing = ((c_isdigit (p[signedp]) || p[signedp] == '.')
- && !NILP (string_to_number (p, 10, &len))
- && len == size_byte);
+ bool confusing =
+ /* Set CONFUSING if NAME looks like a number, calling
+ string_to_number for non-obvious cases. */
+ ((c_isdigit (p[signedp]) || p[signedp] == '.')
+ && !NILP (string_to_number (p, 10, &len))
+ && len == size_byte)
+ /* We don't escape "." or "?" (unless they're the first
+ character in the symbol name). */
+ || *p == '?'
+ || *p == '.';
if (! NILP (Vprint_gensym)
&& !SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (obj))
{
if (c == '\"' || c == '\\' || c == '\''
|| c == ';' || c == '#' || c == '(' || c == ')'
- || c == ',' || c == '.' || c == '`'
- || c == '[' || c == ']' || c == '?' || c <= 040
+ || c == ',' || c == '`'
+ || c == '[' || c == ']' || c <= 040
|| c == NO_BREAK_SPACE
|| confusing)
{
t)))
(should (equal (prin1-to-string (make-marker)) ""))))
+(ert-deftest test-dots ()
+ (should (equal (prin1-to-string 'foo.bar) "foo.bar"))
+ (should (equal (prin1-to-string '.foo) "\\.foo"))
+ (should (equal (prin1-to-string '.foo.) "\\.foo."))
+ (should (equal (prin1-to-string 'bar?bar) "bar?bar"))
+ (should (equal (prin1-to-string '\?bar) "\\?bar"))
+ (should (equal (prin1-to-string '\?bar?) "\\?bar?")))
+
(provide 'print-tests)
;;; print-tests.el ends here