Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code

From: Eli Zaretskii <[email-masked]>
Date: Sat, 03 Jun 2023 08:53:41 +0300

> Date: Fri, 02 Jun 2023 18:50:57 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> I've often been annoyed by the way `ielm` "pretty prints" data,
> so I wrote my own pretty printer, which has evolved over the years.
> I believe it has finally reached a state which may be acceptable
> to more than just myself.
> 
> The new code is in a new function `pp-region`.
> The old code redirects to the new code if `pp-buffer-use-pp-region` is
> non-nil, tho I'm not sure we want to bother users with such
> a config var.  Hopefully, the new code should be good enough that users
> don't need to choose.  Maybe I should make it a `defvar` and have it
> default to t, so new users will complain if it's not good enough?

Thanks.  I almost never use IELM, so I have no significant comments to
this, only minor ones.

> +(defun pp-region (beg end)
> +  "Insert newlines in BEG..END to try and fit within `fill-column'.
> +Presumes the current buffer contains Lisp code and has indentation properly
> +configured for that.
> +Designed under the assumption that the region occupies a single line,
> +tho it should also work if that's not the case."

The first line should say what this command does.

Also, I think this warrants a NEWS entry and should be documented in
the ELisp manual.

> +(defcustom pp-buffer-use-pp-region nil
> +  "If non-nil, `pp-buffer' uses the new `pp-region' code."
> +  :type 'boolean)

Please add :version.  Also, "the new code" should be rephrased to not
use "new" (which doesn't stand the time test).

And the new defcustom should probably be mentioned in the manual,
perhaps where we mention IELM.