Further tweak pp code printing
authorMichael Heerdegen <michael_heerdegen@web.de>
Sun, 12 May 2024 17:55:30 +0000 (19:55 +0200)
committerMichael Heerdegen <michael_heerdegen@web.de>
Sun, 26 May 2024 12:17:21 +0000 (14:17 +0200)
This fixes an aspect of Bug#70868.

* lisp/emacs-lisp/pp.el (pp--insert-lisp): Print characters with
`prin1-char'.  In all other cases consistently print with `prin1'.

lisp/emacs-lisp/pp.el

index f89807c37be3ef9f48f4111aeb00a962aa54c92a..d578e685ca9acd90b45b6eabc6d1542cff827054 100644 (file)
@@ -495,15 +495,12 @@ the bounds of a region containing Lisp code to pretty-print."
     ;; Print some of the smaller integers as characters, perhaps?
     (integer
      (if (<= ?0 sexp ?z)
-         (let ((print-integers-as-characters t))
-           (princ sexp (current-buffer)))
-       (princ sexp (current-buffer))))
+         (princ (prin1-char sexp) (current-buffer))
+       (prin1 sexp (current-buffer))))
     (string
      (let ((print-escape-newlines t))
        (prin1 sexp (current-buffer))))
-    (symbol
-     (prin1 sexp (current-buffer)))
-    (otherwise (princ sexp (current-buffer)))))
+    (otherwise (prin1 sexp (current-buffer)))))
 
 (defun pp--format-vector (sexp)
   (insert "[")