From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code Date: Fri, 09 Jun 2023 08:51:39 +0530 Message-ID: <87cz25b9rw.fsf@gmail.com> References: <83fs799jmi.fsf@gnu.org> <871qirdi3a.fsf@gmail.com> 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="10714"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 63861@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 09 05:22:27 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 1q7Shn-0002gK-Lj for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Jun 2023 05:22:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7ShQ-0003P0-Rw; Thu, 08 Jun 2023 23:22: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 1q7ShP-0003NN-1Q for bug-gnu-emacs@gnu.org; Thu, 08 Jun 2023 23:22:03 -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 1q7ShO-00014E-PC for bug-gnu-emacs@gnu.org; Thu, 08 Jun 2023 23:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7ShO-0007SX-59 for bug-gnu-emacs@gnu.org; Thu, 08 Jun 2023 23:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Jun 2023 03:22: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.168628091128657 (code B ref 63861); Fri, 09 Jun 2023 03:22:02 +0000 Original-Received: (at 63861) by debbugs.gnu.org; 9 Jun 2023 03:21:51 +0000 Original-Received: from localhost ([127.0.0.1]:57975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7ShD-0007S8-19 for submit@debbugs.gnu.org; Thu, 08 Jun 2023 23:21:51 -0400 Original-Received: from mail-oo1-f67.google.com ([209.85.161.67]:48264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7ShA-0007Rt-Jf for 63861@debbugs.gnu.org; Thu, 08 Jun 2023 23:21:49 -0400 Original-Received: by mail-oo1-f67.google.com with SMTP id 006d021491bc7-55b5472ab85so113590eaf.0 for <63861@debbugs.gnu.org>; Thu, 08 Jun 2023 20:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686280903; x=1688872903; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zBSTVL46bUMnxqaP4/MKs6coaXTphlVEWj1YwxFEPDk=; b=AETVqjqJrhoIqsVrcPYR9mmtrYSd/mC5RQHU+LQiF9EZGDKu9q5VYl846HBz0ulc6a 3XwQY4RWvY+tW+ne4+xiktLg8SFB+uEmqmqljoZurhNpTQpdJLw4mfhg7pg+opKVNcbe DmRQnkUj4vVo70qxEVf4sMIiHjYBtCGvkowBwLuQuhsTtIaQXOSjfmZo7ca3CZWR6Ow0 MXlvKjUcLuipTF3DY1+Gq1KSLfQ2zxtZT0RPUzmXaiqhRs4pBCbIdSpK/DGP515tamcJ 3HkeqzUq4zl7STseotlZnWOpNV1OVcjgXQaoei7oSQKduLabd+yEkwwMOR9nXhT1uOse S8cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686280903; x=1688872903; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zBSTVL46bUMnxqaP4/MKs6coaXTphlVEWj1YwxFEPDk=; b=Gxx40RDIIyTjPBw1LHH4E9eHOJKJDkQ1DKWCI4wC1oEwtNHh4mt2i62pmTP4w9eRhq DWI7zaMsx0/KmLIi6je5axcqhBXWwPxpFVPbxqr4aw9YuzwujzwkftVHVMQYGR7NC3V/ 4qlBTO22Z+MB2qVDelix9kQsYti+f6wPrASJu39mSGmuo9AemttOxXhOoX1Iny0T783j g5/fNCWceniGgVaOakCVmQfYGyzd17kRKeVAMQKuyDgGDqiX2YXMJ491AUroCblq/fwL tqqjmjB/Jeo4YCCB9c/3fR2F85fxUQMUioyHMVVzuWq/KI4BP74MiGB93IzQ+Hx+w8Ix nqcA== X-Gm-Message-State: AC+VfDzRDpHoMgMNKNeCmPULCIZkCLPRenEwnUScBuraucdMvmL8/ePe Ux9hMgBRim3NYlyk0fgb8xk= X-Google-Smtp-Source: ACHHUZ6vI5SRjcqEjySSh5ceMVfKDceZ3qlGTbBqmxcZ1P06a57m6eTuoCS3aqhx6UGzqtMpbHVwvw== X-Received: by 2002:a05:6359:a26:b0:129:c25e:1cb0 with SMTP id el38-20020a0563590a2600b00129c25e1cb0mr166389rwb.30.1686280902701; Thu, 08 Jun 2023 20:21:42 -0700 (PDT) Original-Received: from localhost ([49.205.80.56]) by smtp.gmail.com with ESMTPSA id z24-20020a63c058000000b0051ba9d772f9sm1919176pgi.59.2023.06.08.20.21.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 20:21:42 -0700 (PDT) In-Reply-To: (Stefan Monnier via's message of "Wed, 07 Jun 2023 11:48:32 -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:263152 Archived-At: [=E0=AE=AA=E0=AF=81=E0=AE=A4=E0=AE=A9=E0=AF=8D =E0=AE=9C=E0=AF=82=E0=AE=A9= =E0=AF=8D 07, 2023] Stefan Monnier via "Bug reports for GNU Emacs, the Swis= s army knife of text editors" wrote: >> BTW, how does this compare to the newly added `pp-emacs-lisp-code`? > > Very good question. I had completely missed that (and its `pp-use-max-wi= dth`). > This points to a host of integration issues between my code and the > existing code. I'll have to take a deeper look. >From what I remember, pp simply switches to use pp-emacs-lisp-code when the relevant user option is set. The poor performance of pp-emacs-lisp-code made me wish pp-use-max-width was only obeyed by user facing commands like pp-eval-expression & friends. >> It was still rough around the edges the last time I set >> `pp-use-max-width' non-nil. It is also quite a lot slower than the >> old path. > > My new code is expected to be slower than the "normal" pretty-printer, > but barring performance bugs in `lisp-indent-line` (such as the one > fixed by the patch I just sent to Thierry) it should be approximately > a constant factor slower. > > AFAICT the performance of `pp-emacs-lisp-code` can be more problematic. Hopefully, the constant factor is quite small. pp-emacs-lisp-code took a lot of time to print my modest bookmark alist (28 entries) and for the longest time I thought some other code in Emacs has gone awry. > Beside performance, I guess the behavior of the two should be > somewhat similar, tho I also see that `pp-emacs-lisp-code` pays > attention to the Edebug and `doc-string-elt` info, so it may give > slightly more refined info. I haven't tested your pretty printer but pp-emacs-lisp-code could give some really bizarre results for lisp data. Unfortunately, I don't have any examples handy to illustrate what I mean by bizarre though.=20 > Another difference is that `pp-emacs-lisp-code` starts with an S-exp > object, whereas my code starts with a region (i.e. an sexp that's > already been printed). > > > Stefan