[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63861: [PATCH] pp.el: New "pretty printing" code
From: |
Eli Zaretskii |
Subject: |
bug#63861: [PATCH] pp.el: New "pretty printing" code |
Date: |
Sat, 03 Jun 2023 21:58:03 +0300 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: 63861@debbugs.gnu.org
> Date: Sat, 03 Jun 2023 14:18:36 -0400
>
> >> +(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.
>
> How 'bout:
>
> Insert line-breaks in Lisp code so it fits within `fill-column`.
>
> ?
Yes, but let's also mention BEG and END:
Break lines in Lisp code between BEG and END so it fits within `fill-column'.
> > Also, I think this warrants a NEWS entry and should be documented in
> > the ELisp manual.
>
> Definitely for NEWS, yes. For the ELisp manual, currently we don't
> document `pp-buffer`, the closest I see is `indent-pp-sexp` (in
> `programs.texi`).
> I'm not sure what to put in there. nor where to put it.
We document "pp" in "Output Functions". Maybe there?
> >> +(defcustom pp-buffer-use-pp-region nil
> >> + "If non-nil, `pp-buffer' uses the new `pp-region' code."
> >> + :type 'boolean)
> > Please add :version.
>
> Hmm... so you think it should stay as a `defcustom` and we should thus
> plan to keep both kinds of pretty-printing in the long term?
No, I just said that _if_ we keep it as a defcustom, _then_ it should
have a :version tag. I have no idea how many users will want to
customize this.
> I mostly intended it to be a temporary knob for people to be able to try
> the new code and easily compare with the old (or revert to the old when
> bumping into a problem with the new).
>
> If so, we should probably think of better names to distinguish the two
> pp styles than `pp-buffer` vs `pp-region`. Maybe `pp-fill` for the new
> code since arguably the main difference is that the new code pays
> attention to `fill-column`? I don't have a good idea for a name for the
> old code, OTOH (and I think it would make sense to keep `pp-buffer` as
> a dispatch between the two options, so it would be good to have
> a separate name for the old style).
>
> Another difference might be that the new style is maybe aimed more at
> pp'ing code than data, whereas the old style might be a bit more
> "agnostic" to the definition. Yet another difference is that the old
> code tends to use more lines (because it doesn't try to fill the line
> upto `fill-column`) and occasionally outputs very long lines because it
> only breaks lines near parentheses.
>
> Maybe that info can inspire someone to come up with a good name for this
> "old style"?
Maybe we should leave it as a variable for now, and see if there's
enough demand for both flavors.
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/02
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Eli Zaretskii, 2023/06/03
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/03
- bug#63861: [PATCH] pp.el: New "pretty printing" code,
Eli Zaretskii <=
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/12
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Eli Zaretskii, 2023/06/13
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/16
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Eli Zaretskii, 2023/06/17
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/17
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Eli Zaretskii, 2023/06/17
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/17
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Visuwesh, 2023/06/03
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Stefan Monnier, 2023/06/07
- bug#63861: [PATCH] pp.el: New "pretty printing" code, Visuwesh, 2023/06/08