GNU bug report logs - #66042
30.0.50; ERT test fails while trying to indent pretty-print

Previous Next

Package: emacs;

Reported by: Protesilaos Stavrou <info <at> protesilaos.com>

Date: Sun, 17 Sep 2023 06:14:02 UTC

Severity: normal

Tags: confirmed

Found in version 30.0.50

Full log


Message #16 received at 66042 <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: Stefan Kangas <stefankangas <at> gmail.com>, Mauro Aranda
 <maurooaranda <at> gmail.com>, 66042 <at> debbugs.gnu.org
Cc: Lei Zhu <julytreee <at> gmail.com>
Subject: Re: bug#66042: 30.0.50; ERT test fails while trying to indent
 pretty-print
Date: Mon, 18 Sep 2023 07:54:58 +0300
[Message part 1 (text/plain, inline)]
Hello Stefan, Mauro,

> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sun, 17 Sep 2023 04:47:29 -0700

> [... 20 lines elided]

> I can't reproduce this on current master.  Evaluating the above two
> forms in emacs -Q and then saying

> [... 23 lines elided]

> Which version of Emacs are you running?
>
> Can you reproduce it in emacs -Q?

Yes, I can reproduce it with 'emacs -Q' on Emacs trunk.  I tried it just
now with the following code.  See attached screenshot.

    (require 'ert)

    (defun ert--pp-with-indentation-and-newline (object)
      "Pretty-print OBJECT, indenting it to the current column of point.
    Ensures a final newline is inserted."
      (let ((begin (point))
            (pp-escape-newlines t)
            (print-escape-control-characters t))
        (pp object (current-buffer))
        (unless (bolp) (insert "\n"))
        (save-excursion
          (goto-char begin)
          (indent-sexp)
          )))

    (ert-deftest my-kill-backward-test-close-parens ()
      "aaa)))"
      (test-case "aaa)))" 7 "aaa"))

    (defun test-case (text pos expected)
      (with-temp-buffer
        (insert text)
        (goto-char pos)
        (backward-kill-word 1)
        (should (string-equal (buffer-string) expected))))

If I restart Emacs, comment out (indent-sexp), then evaluate the buffer,
and then the ERT test, everything works as expected.  There is no
'wholenump' error.

All the best,
Prot

-- 
Protesilaos Stavrou
https://protesilaos.com
[2023-09-18_07:50:02_1274x1056.png (image/png, attachment)]

This bug report was last modified 1 year and 271 days ago.

Previous Next


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