Subject: Re: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline

From: Stefan Monnier <[email-masked]>
Date: Thu, 22 Aug 2024 09:43:14 -0400

> Actually, that can probably be simplified a bit.

BTW, it could be argued that the `indent-rigidly` should take place in
`pp` (i.e. consider it as a bug in `pp`).

The patch looks good to me, tho I have the following nitpicks:

>    (let ((begin (point))
> +        (cols (- (point) (line-beginning-position)))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                 (current-column)

>          (pp-escape-newlines t)
>          (print-escape-control-characters t))
>      (pp object (current-buffer))
>      (unless (bolp) (insert "\n"))
> -    (save-excursion
> -      (goto-char begin)
> -      (indent-sexp))))
> +    (indent-rigidly begin (point-max) cols)))
>                            ^^^^^^^^^^^
                             (point)

We arguably know that (point) is the same as (point-max) here, so it's
not really important, but (point) is shorter and conceptually more
correct since we wouldn't want to shift text that was there before.

        Stefan