Subject: Re: bug#69168: [BUG] 30.0.50; pp-emacs-lisp-code produces invalid elisp for backquoted forms

From: Michael Heerdegen <[email-masked]>
Date: Sun, 25 Feb 2024 06:00:38 +0100

Michael Heerdegen <[email-masked]> writes:

> The second problem is that the recursive calls of `pp--insert-lisp'
> print symbols using `princ' (i.e., without quoting), so even the list
> representation is wrong.

I think we should print any symbol using `prin1', not `princ' - printing
symbols that need quoting without quoting is not useful:

From f493708a456608f59b29c3f2308ecc51177667ec Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <[email-masked]>
Date: Sun, 18 Feb 2024 02:48:15 +0100
Subject: [PATCH] Fix pp-emacs-lisp-code printing of symbols

* lisp/emacs-lisp/pp.el (pp--insert-lisp): Print symbols
readably (bug#69168).
---
 lisp/emacs-lisp/pp.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 1d722051406..944dd750839 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -458,6 +458,8 @@ pp--insert-lisp
     (string
      (let ((print-escape-newlines t))
        (prin1 sexp (current-buffer))))
+    (symbol
+     (prin1 sexp (current-buffer)))
     (otherwise (princ sexp (current-buffer)))))

 (defun pp--format-vector (sexp)
--
2.39.2

Michael.