From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
70868@debbugs.gnu.org, iarchivedmywholelife@gmail.com
Subject: bug#70868: 30.0.50;
Date: Sun, 12 May 2024 20:11:17 +0200 [thread overview]
Message-ID: <87h6f2q4sa.fsf@web.de> (raw)
In-Reply-To: <86frunyr3o.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 12 May 2024 18:42:03 +0300")
[-- Attachment #1: Type: text/plain, Size: 127 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
> > Yes - but independent of that I think we want to switch printing using
> > `prin1'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-emacs-lisp-pp.el-pp-insert-lisp-Always-print-wi.patch --]
[-- Type: text/x-diff, Size: 1294 bytes --]
From 3024833e9557e2400a83f0e71b474c35d927260d Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Sun, 12 May 2024 19:55:30 +0200
Subject: [PATCH 1/2] * lisp/emacs-lisp/pp.el (pp--insert-lisp): Always print
with prin1
This fixes an aspect of Bug#70868.
---
lisp/emacs-lisp/pp.el | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 47805d3dbde..f24b0d55520 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -494,16 +494,12 @@ pp--insert-lisp
(prin1 sexp (current-buffer)))))
;; 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))))
+ (let ((print-integers-as-characters (<= ?0 sexp ?z)))
+ (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 "[")
--
2.39.2
[-- Attachment #3: Type: text/plain, Size: 39 bytes --]
And while we talk about these lines:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0002-Don-t-try-to-pretty-print-non-lists-as-binding-list.patch --]
[-- Type: text/x-diff, Size: 1057 bytes --]
From d9c32c4bce32838fbe44a0f8bfb4ed04b34d65f7 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Sun, 12 May 2024 19:58:14 +0200
Subject: [PATCH 2/2] Don't try to pretty print non-lists as binding list
* lisp/emacs-lisp/pp.el (pp--format-definition): Avoid barfing for SEXPs
like (let X Y) in `pcase' forms: ensure that what we try to print as
a list of bindings actually has an appropriate format.
---
lisp/emacs-lisp/pp.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index f24b0d55520..aae3d2f78bf 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -576,7 +576,8 @@ pp--format-definition
(unless (consp edebug)
(setq edebug nil))
(if (and (consp (car edebug))
- (eq (caar edebug) '&rest))
+ (eq (caar edebug) '&rest)
+ (proper-list-p (car sexp)))
(pp--insert-binding (pop sexp))
(if (null (car sexp))
(insert "()")
--
2.39.2
[-- Attachment #5: Type: text/plain, Size: 457 bytes --]
> That will probably come with problems of its own...
Unless it's clear: keep in mind that we only speak about atomic objects
here (no sequences) - this helper function is only intended for simple
objects like characters.
Also note that - unless I'm missing some aspect - printing with `princ'
instead of `prin1' will either produce the same result or a broken
result that cannot be `read' - and the function makes the promise to
print code.
Michael.
next prev parent reply other threads:[~2024-05-12 18:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 23:56 bug#70868: 30.0.50; pp--insert-lisp prints small integers as characters No Wayman
2024-05-11 0:10 ` No Wayman
2024-05-11 6:47 ` Eli Zaretskii
2024-05-11 10:58 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-11 11:09 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-11 12:08 ` Mattias Engdegård
2024-05-11 14:48 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-11 15:10 ` Mattias Engdegård
2024-05-11 11:32 ` Andreas Schwab
2024-05-11 10:54 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-11 16:38 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-11 16:47 ` Eli Zaretskii
2024-05-11 18:26 ` bug#70868: 30.0.50; iarchivedmywholelife
2024-05-11 18:29 ` Eli Zaretskii
2024-05-11 18:33 ` Eli Zaretskii
2024-05-12 14:50 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-12 15:06 ` Eli Zaretskii
2024-05-12 15:15 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-12 15:42 ` Eli Zaretskii
2024-05-12 18:11 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-05-28 10:51 ` bug#70868: 30.0.50; pp--insert-lisp prints small integers as characters Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-12 21:39 ` bug#70868: 30.0.50; Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14 18:25 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14 22:30 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14 18:28 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14 20:16 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6f2q4sa.fsf@web.de \
--to=bug-gnu-emacs@gnu.org \
--cc=70868@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=iarchivedmywholelife@gmail.com \
--cc=michael_heerdegen@web.de \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.