From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code Date: Sat, 17 Jun 2023 19:42:44 +0300 Message-ID: <83ttv6oxa3.fsf@gnu.org> References: <83fs799jmi.fsf@gnu.org> <83r0qs74qs.fsf@gnu.org> <83pm5zws19.fsf@gnu.org> <83h6r6sl50.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5665"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63861@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 17 18:43:17 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 1qAZ1A-0001Kn-9p for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Jun 2023 18:43:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAZ0y-0003kJ-5s; Sat, 17 Jun 2023 12:43:04 -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 1qAZ0w-0003k7-JY for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 12:43: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 1qAZ0w-0005mZ-BC for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 12:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAZ0w-0001qg-2D for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 12:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Jun 2023 16:43:02 +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.16870201737088 (code B ref 63861); Sat, 17 Jun 2023 16:43:02 +0000 Original-Received: (at 63861) by debbugs.gnu.org; 17 Jun 2023 16:42:53 +0000 Original-Received: from localhost ([127.0.0.1]:52539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAZ0n-0001qG-3L for submit@debbugs.gnu.org; Sat, 17 Jun 2023 12:42:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAZ0k-0001q3-Mi for 63861@debbugs.gnu.org; Sat, 17 Jun 2023 12:42:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAZ0e-0005l3-Rd; Sat, 17 Jun 2023 12:42:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=O81LDuZiaE4cy0YjwZEzVBeBFdmOWBJNdYEbXsz/IIA=; b=BVLr7hmQ6gFK /tS5YjflIoAbLJvPdrteY1QIRImkUqvv0qI3QDCXhDfI9cltigOGvX7FCVT8F1oObZL2jHKUIGASs tzzBvOE/bHDCoBw/izcjSjG/nrNP8mSkYz2NXB6mVUwsXghocyYCsKAytibFN79ZCxV69m81ppg4K IcyDlJaIVGsdabGleiOQXj03z25hMN09OtewRXPkCeUcDCBvGjHJ6mgAtQ5m6yot8G9aLDBjanbms r78RzgR91+OFeHKhcRylooFaml2lPnRrnKkbBeSLgpUGuKoANFN0fbzkof+nEENsUT7G51+qSi6Pz fIbpOC3ywhee+rZMQf51Kw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAZ0e-00012u-Bi; Sat, 17 Jun 2023 12:42:44 -0400 In-Reply-To: (message from Stefan Monnier on Sat, 17 Jun 2023 12:13:54 -0400) 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:263559 Archived-At: > From: Stefan Monnier > Cc: 63861@debbugs.gnu.org > Date: Sat, 17 Jun 2023 12:13:54 -0400 > > >> +@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? Something like this: The function can be called to pretty-print either a region of text, presumably containing the printed representation of one or more objects, or to pretty-print an object. In the first case, the function must be called with 2 arguments, @var{object-or-beg} and @var{stream-or-end}, which are integer buffer positions that define the region; in the second case, @var{object-or-beg} is the object to print and @var{stream-or-end} is the stream to which to print it, which defaults to @code{standard-output} if nil or omitted. > 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? That might be better, indeed, both for documentation and for usage.