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

From: No Wayman <[email-masked]>
Date: Thu, 15 Feb 2024 14:19:19 -0500

Observe the output of the following two expressions:

(eval (read (with-temp-buffer
              (pp-emacs-lisp-code '`(1+ ,(1+ 1)))
              (buffer-string)))
      t)

;; => eval: Invalid function: `(1+ (,(1+ 1)))

(eval
 (read (with-temp-buffer
         (insert (pp-to-string '`(1+ ,(1+ 1))))
         (buffer-string)))
 t)

;; => (1+ 2)

The form returned by pp-emacs-lisp-code is:

(` (1+ (, (1+ 1))))

The backqoute and comma are not escaped, resulting in the error.
It looks like the logic in pp--insert-lisp would need to be 
extended to account for backquoting constructs.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-02-03 built on laptop
Repository revision: 4ebded3f5ee8617ac6b1debaa01706cd78206f39
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 
11.0.12101011
System Description: Arch Linux