GNU bug report logs -
#72561
31.0.50; Scan error in ert--pp-with-indentation-and-newline
Previous Next
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
Message #11 received at 72561 <at> debbugs.gnu.org (full text, mbox):
> Error: scan-error ("Containing expression ends prematurely" 221 221)
> forward-sexp-default-function(-1)
> forward-sexp(-1)
> calculate-lisp-indent((5 221 238 nil nil nil 4 nil nil (5 27 161 175
> lisp-indent-calc-next(#s(lisp-indent-state :stack (50 16 6 5 nil) :p
> indent-sexp()
> ert--pp-with-indentation-and-newline((ert-test-failed ((should (equa
Hmm...
> --- a/lisp/emacs-lisp/ert.el
> +++ b/lisp/emacs-lisp/ert.el
> @@ -1323,7 +1323,8 @@ ert--pp-with-indentation-and-newline
> (unless (bolp) (insert "\n"))
> (save-excursion
> (goto-char begin)
> - (indent-sexp))))
> + (with-syntax-table emacs-lisp-mode-syntax-table
> + (indent-sexp)))))
Your patch makes sense: indeed, looking at the code of `indent-sexp`,
I see that it uses `lisp-indent*` functions in a way which presumes that
we're looking at Lisp code and would require a list-mode syntax-table.
I wonder why this has not bitten us earlier in other circumstances.
But I also wonder why `ert--pp-with-indentation-and-newline` calls
`indent-sexp`, since `pp` should have done that for us already, so I'd
be tempted to just remove that call. Or maybe the purpose is to "shift"
the text when `begin` is not in column 0?
If so, maybe `indent-rigidly` is a better way to get the same result?
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.