From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code Date: Sat, 17 Jun 2023 12:13:54 -0400 Message-ID: References: <83fs799jmi.fsf@gnu.org> <83r0qs74qs.fsf@gnu.org> <83pm5zws19.fsf@gnu.org> <83h6r6sl50.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33995"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63861@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 17 18:15:20 2023 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 1qAYa7-0008e0-HA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Jun 2023 18:15:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAYZu-0007b6-AH; Sat, 17 Jun 2023 12:15:06 -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 1qAYZq-0007as-2n for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 12:15:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAYZp-000135-PM for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 12:15:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAYZp-0006zH-LC for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 12:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Jun 2023 16:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63861 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63861-submit@debbugs.gnu.org id=B63861.168701844526768 (code B ref 63861); Sat, 17 Jun 2023 16:15:01 +0000 Original-Received: (at 63861) by debbugs.gnu.org; 17 Jun 2023 16:14:05 +0000 Original-Received: from localhost ([127.0.0.1]:52493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAYYv-0006xg-D8 for submit@debbugs.gnu.org; Sat, 17 Jun 2023 12:14:05 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAYYs-0006wX-1a for 63861@debbugs.gnu.org; Sat, 17 Jun 2023 12:14:03 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8BF901001FC; Sat, 17 Jun 2023 12:13:56 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 93E7E100083; Sat, 17 Jun 2023 12:13:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1687018435; bh=NO1TUCeNyUcPafTSLvzvfWJ/hKQkDVkkpyAHZ+719HY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CUaA3PIr3t0iunxIfnOy671lvGbe97N/Zm3BrjfIwJ1PCMIbrTkYHK+YZL3dC3rQp bNxT3Y3PSbQ5TWhOGTa1u49ECT1dZrYwYncd9WiJKNyBCzfONLSRAguNu9+NY/4rwz 46TmMFlV7aJFuZ+Q9qJxN4h1vtPni7bMh2orQE4/snTMHYdS5Z4FS6ytcKcaIzGKiu /ig6B/kOw7nU2CjjUgvSXbjMXKrdiDCpjGuvYp2mlvKE8BmKgx0Ymu5WoHsI1jjP1p aaq5hhKioNZkdKXksu5+bRx1Kn7EtLARiHy1mJHd+m3OVikFS3cQHMMPsS2skEwDX3 ZSwpeS7etdeMg== Original-Received: from pastel (unknown [45.72.207.87]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 706AE12086B; Sat, 17 Jun 2023 12:13:55 -0400 (EDT) In-Reply-To: <83h6r6sl50.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 17 Jun 2023 08:39:07 +0300") 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:263553 Archived-At: >> From: Stefan Monnier >> Cc: 63861@debbugs.gnu.org >> Date: Fri, 16 Jun 2023 14:26:54 -0400 >>=20 >> +(defun pp-28 (beg &optional end) ;FIXME: Better name? >> + "Prettify the current region with printed representation of a Lisp ob= ject. >> +Uses the pretty-printing algorithm that was standard in Emacs=E2=89=A42= 9. > ^^^^^^^^ > Please avoid non-ASCII characters in doc strings: they could produce > display problems on less-than-capable terminals. OK >> +@defun pp object-or-beg &optional stream-or-end >> +This function indents and fills the printed representation of an >> +object (typically representing ELisp code) to make it more readable >> +for humans. >> + >> +It accepts two calling conventions: if called with two integers >> +@var{beg} and @var{end}, it indents and fills the corresponding >> +region, presumably containing the printed representation of one or >> +more objects, otherwise it takes a @var{object} and an optional >> +@var{stream}, and prints @var{object} like @code{prin1}, but does it >> +in a prettier way. > > This text references arguments like @var{object} that are named > differently in the @defun line. Indeed. Assuming you understood what I meant to say, do you have a recommendation of how to write it? Or maybe, I should leave `pp` alone and add a new `pp-region` function instead instead of combining two different calling conventions on a single function? The reason I've done that is because it was difficult to avoid doing it for the "backend functions" (those that can be put on `pp-default-function`), but admittedly, that doesn't have to carry over to `pp`. Stefan