From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70868: 30.0.50; Date: Tue, 14 May 2024 20:25:30 +0200 Message-ID: <87cypomesl.fsf@web.de> References: <663fb841.050a0220.ffcbb.b84f@mx.google.com> <86jzk019u0.fsf@gnu.org> <86h6f419mi.fsf@gnu.org> <87v83jozi7.fsf@web.de> <86ikzjysrh.fsf@gnu.org> <87r0e7oyct.fsf@web.de> <86frunyr3o.fsf@gnu.org> Reply-To: Michael Heerdegen Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30827"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eliz@gnu.org, monnier@iro.umontreal.ca, iarchivedmywholelife@gmail.com To: 70868@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 14 20:26:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s6wqu-0007pE-AF for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 May 2024 20:26:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6wqn-0002Uf-U9; Tue, 14 May 2024 14:26:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6wqg-0002Tj-Fc for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 14:26:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6wqf-00066W-Ko for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 14:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6wqg-0003D2-6M for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 14:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 May 2024 18:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70868 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Eli Zaretskii , Stefan Monnier , 70868@debbugs.gnu.org, iarchivedmywholelife@gmail.com Original-Received: via spool by submit@debbugs.gnu.org id=B.171571113912327 (code B ref -1); Tue, 14 May 2024 18:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 May 2024 18:25:39 +0000 Original-Received: from localhost ([127.0.0.1]:40744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6wqI-0003Cl-QS for submit@debbugs.gnu.org; Tue, 14 May 2024 14:25:39 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6wqE-0003Cf-7J for submit@debbugs.gnu.org; Tue, 14 May 2024 14:25:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6wq4-0002HI-OG for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 14:25:25 -0400 Original-Received: from mout.web.de ([212.227.17.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6wpu-0005cf-Lq; Tue, 14 May 2024 14:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1715711087; x=1716315887; i=michael_heerdegen@web.de; bh=w9/ge1PUeVX+ZXBtEo8dLE79t0prJRAUPu4S+lg9a08=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=UV5m46JnVEWNCuAl307oxRh+ysDVJ4YIR6vVaB/Ig83rEHjaHAY0/Wb8iGzM86RT Fm1NKfjn5ntjqkO5VW/vE6uk8uVCzhYLkMHwnpBqQWW/4kAqhw2YdKWqRslE90wdG kSZEsvwXTjl5pObo5d4PVmp/tMFSPQePdNHI+NTS4ra/H5YTQRKvxlhjY+BYUMmac A4HM7PPq74U2poMNAn+maRSy/4ZU09gPCRP+nSHw/EaOFpBbQ8b/0btv4Sg9etju/ C36K0oRARSXkOZFjrPvp9ae9Z2QIBn7WcRqoEZ095XA8j75Lrd9AfH3CsqfU3OmAt 5vnRhjp2lnCrGQ0y9g== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([84.57.248.23]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N8Vop-1sbO0d3RVR-014Vt6; Tue, 14 May 2024 20:24:46 +0200 In-Reply-To: (Stefan Monnier via's message of "Sun, 12 May 2024 17:39:46 -0400") X-Provags-ID: V03:K1:2hawpr6gIeHOLjVE2JgQqzNXFZE0WaBh9ozleOdpZK5DzF+tvRR D7H2ZuG9O1JQtm/Nq9CSB8ylhdXdf4Zorxc3BEqId4YvaJ0FpSdRfaAgOuAIlH7U6954hjh fn5jE7un8pnPgJrLzpMjREJTBfYaZC3mvlV0owiECNrVQ9p72LYHEu5LDo43iW1g1VExGPW Sn5ItXmiRjhS39FFJrHrQ== UI-OutboundReport: notjunk:1;M01:P0:v1mbxZs/7YU=;nSkNdC4GJXfOss2+NgriGzHpzq2 dnxMOWZpTwzmvlZ1/iUQ6T8LI8gatztonrg6APt6N/YwOMYIvpxGRBcXe6I7SEJaKmW+DrzH1 5XYjXPA2UtLELsAMGV6KDaxiE7ItJMXWGOWA0T9kPXTjiDRxnIRCZvnT4N3NtcsWxM1C9EfYV deLEeU8etvWECFkayYYNMVAtNdM6Sij+dW8I4Hy7GK7vQ6WXV4iAgjlhLA7i7cIoX7lOS/IEn nh7EfK7A4vMPW9geC/hDhaaRCCDdbpDhdx0WXEeqcV/sQERxs6nU1zcePAeLqUFmKjcTuvWdK 4Wpek/m/QKY525CdC1Kt5x6VzkFm9tSQjO7vRYNsH9/139qUCdYEPFODIJpcC6NpYbsFGC0Vi fmNbXzRlbdZBpOrUU6quVvczvmpHGAmLlhg8UjRiPG4IG772plGjOO/ypOrg6tf8k8LPk1fOe XghrD7s2tuLgKhxw/nb6gkq1NJ8SupGAZHN9DJ+XUixApXp3OMR/admDh9C1GEiPTrTTPRRgT czmtGrsSibNbCLqvUiTAlpMf/0M1PiLgqvbdpru5EEjT4nUi91xs7EXhEpY/nNl9cPZx+gqTL d4GyMUeDPFoKD23ZQQNBwPkd5+yJOvmI0hOmsJEYN6syPAhyrU4sRfxrTo6WjXnstQ0KAT9Zg rokR7vU+mmNE4n1QV3kLF9e/ZPH1AixSRtsDg5eoaYaAVewX8ilx3mFKjN5j8niVKShOLxUGr 39KH/L4ZT7Whlv2hmLGPWQPermSaEWWAnmRrSnlS/dIT+37TtvUS7TraaXNzs3mjIkJQbC/N Received-SPF: pass client-ip=212.227.17.12; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285039 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > `prin1` will have its share of downsides, I guess, but when printing > "arbitrary data", it's definitely a safer choice than `princ` which > is rarely the right thing (except when printing strings, obviously). I hope you only mean strings that contain the printed representation of an object. Our `pp--insert-lisp' prints strings in the argument with `prin1' (of course). > This said, I don't see the connection with printing small numbers as > chars. There is none - but we constantly keep replacing every single `princ' with `prin1' in that function, one after the other, so I suggest to switch to `prin1' for all objects and see if anything remains where that behaves unintuitively. > To print chars using the ELisp syntax you need `prin1-char`: AFAIK > neither `prin1` nor `princ` work (at all). Thanks for that comment - I updated the patch to use `prin1-char': --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Further-tweak-pp-code-printing.patch Content-Transfer-Encoding: quoted-printable =46rom e041c3a9d295f4c9946bcb693591eb47237cc4fe Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Sun, 12 May 2024 19:55:30 +0200 Subject: [PATCH] Further tweak pp code printing 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'. =2D-- lisp/emacs-lisp/pp.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el index 47805d3dbde..1ca206cf5db 100644 =2D-- a/lisp/emacs-lisp/pp.el +++ b/lisp/emacs-lisp/pp.el @@ -495,15 +495,12 @@ pp--insert-lisp ;; Print some of the smaller integers as characters, perhaps? (integer (if (<=3D ?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 "[") =2D- 2.39.2 --=-=-= Content-Type: text/plain And I would leave the specially handled range of integers as is. Look: there are really pathological cases that are very ugly. For example, ?\n competes with 10, a very frequently occurring integer. Thanks, Michael. --=-=-=--