From 0a500193087efc96aa3791dc4c2084ef5f6c3c06 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 9 Aug 2024 16:49:28 -0700 Subject: Indent ERT failure explanations rigidly This also affects the listing of `should' forms produced by hitting the L key on a test button in an ERT buffer. * lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline): Indent the pretty-printed result to match the caller's current column as a reference indentation. * test/lisp/emacs-lisp/ert-tests.el (ert--pp-with-indentation-and-newline): New test. (Bug#72561) --- lisp/emacs-lisp/ert.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 2d96e5ce5a9..105c44d49aa 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1317,13 +1317,12 @@ empty string." "Pretty-print OBJECT, indenting it to the current column of point. Ensures a final newline is inserted." (let ((begin (point)) + (cols (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) cols))) (defun ert--insert-infos (result) "Insert `ert-info' infos from RESULT into current buffer. -- cgit v1.2.3