GNU bug report logs - #72561
31.0.50; Scan error in ert--pp-with-indentation-and-newline

Previous Next

Package: emacs;

Reported by: "J.P." <jp <at> neverwas.me>

Date: Sat, 10 Aug 2024 13:55:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Done: "J.P." <jp <at> neverwas.me>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "J.P." <jp <at> neverwas.me>
Cc: 72561 <at> debbugs.gnu.org
Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline
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





This bug report was last modified 344 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.