From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Aug 2024 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 72561@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172329804428026 (code B ref -1); Sat, 10 Aug 2024 13:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Aug 2024 13:54:04 +0000 Received: from localhost ([127.0.0.1]:39214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scmXj-0007Hx-GG for submit@debbugs.gnu.org; Sat, 10 Aug 2024 09:54:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:49948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scmXe-0007HW-Ut for submit@debbugs.gnu.org; Sat, 10 Aug 2024 09:54:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scmXA-0003fL-Bp for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 09:53:29 -0400 Received: from mail-108-mta130.mxroute.com ([136.175.108.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1scmX7-0007t5-RU for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 09:53:28 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta130.mxroute.com (ZoneMTA) with ESMTPSA id 1913c8c01df0000a78.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 10 Aug 2024 13:48:14 +0000 X-Zone-Loop: 65210683b5fc42461ad170d76efe1b523d973a7eca96 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ELEZCJ5qX69gz1gSViH5TePMVj9kLF97OSLxqs4i9rY=; b=WJvyhsjESJk2tuCqj3LfjftC+o znOAWgVejEH6XJGMsiOs2B5+6gcZVNliIqJnEdbsrhoQqweMlTg/lzEfn+av+cCX7LxqeKARWDL9A sVFWu5Eag93m/2dYjSpbNom+bAFatvtkFreIKNLUXi0KZs7FuTCJ+HaJt84gZeFP1KTQc8LOlOYPu 4f/BODTFIzX6/2nRADe8PUoI9K1I2osyeNzETQVVLgtuXUwZxBbJBTg+1VZal1wZQUruEjMtAUcr4 0PkC9hgEljvbiLphJdI2PMzEfOI7cdE5LodikAtNSP1zHWkhk+JCzdPcCZZ4XUUrxsAXRNp9gG9IM 6aVSmc+w==; From: "J.P." Date: Sat, 10 Aug 2024 06:48:11 -0700 Message-ID: <87v808o5es.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Authenticated-Id: masked@neverwas.me Received-SPF: pass client-ip=136.175.108.130; envelope-from=jp@neverwas.me; helo=mail-108-mta130.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch This apparently began after 2f181d60323bd9e0196775828de633100479f4c2 Author: Stefan Monnier AuthorDate: Fri Jun 16 13:35:06 2023 -0400 CommitDate: Sat Jun 17 17:24:38 2023 -0400 pp.el (pp-fill): New default pp function 1 file changed, 90 insertions(+), 1 deletion(-) lisp/emacs-lisp/pp.el | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++- So I guess it also affects Emacs 30. To reproduce, put this in test/lisp/emacs-lisp/ert-tests.el: (ert-deftest ert--pp-with-indentation-and-newline () (should (equal '((:one "1" :three "3" :two "2")) '((:one "1"))))) Then run something like: $ make -C test \ SELECTOR=ert--pp-with-indentation-and-newline \ lisp/emacs-lisp/ert-tests.log 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 #f(compiled-function (event-type &rest event-args) #)() ert-run-or-rerun-test(#s(ert--stats :selector ert--pp-with-indentati Aborted: Ran 1 tests, 0 results as expected, 1 unexpected, -1 skipped No idea if there's a deeper issue at play here, maybe something in pp.el that a patch like the attached would just be papering over. In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-08-09 built on localhost Repository revision: 944e45db53cb173c5eadd4794081c133e8649d67 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12401002 System Description: Fedora Linux 40 (Workstation Edition) Configured using: 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3' PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run bytecomp byte-compile comp-common rx emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar make-network-process native-compile emacs) Memory information: ((conses 16 58857 9185) (symbols 48 6741 0) (strings 32 16558 3964) (string-bytes 1 477530) (vectors 16 11257) (vector-slots 8 135809 8706) (floats 8 21 4) (intervals 56 249 0) (buffers 984 11)) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Indent-failed-ERT-should-forms-with-Emacs-Lisp-synta.patch >From 2a65e655ae62c1ee74a15747c228b3c19a871f9e Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 9 Aug 2024 16:49:28 -0700 Subject: [PATCH] Indent failed ERT should forms with Emacs Lisp syntax * lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline): Use `emacs-lisp-mode-syntax-table' when indenting. * test/lisp/emacs-lisp/ert-tests.el (ert--pp-with-indentation-and-newline): New test. --- lisp/emacs-lisp/ert.el | 3 +- test/lisp/emacs-lisp/ert-tests.el | 54 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 6a665c8181d..6f5a0093ba0 100644 --- 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))))) (defun ert--insert-infos (result) "Insert `ert-info' infos from RESULT into current buffer. diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 1aff73d66f6..cdbeae2f2e5 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -876,6 +876,60 @@ ert-test-get-explainer (should (eq (ert--get-explainer 'string-equal) 'ert--explain-string-equal)) (should (eq (ert--get-explainer 'string=) 'ert--explain-string-equal))) +(ert-deftest ert--pp-with-indentation-and-newline () + :tags '(:causes-redisplay) + (let ((failing-test (make-ert-test + :name 'failing-test + :body (lambda () + (should (equal '((:one "1" :three "3" :two "2")) + '((:one "1"))))))) + (want-body "\ +Selector: +Passed: 0 +Failed: 1 (1 unexpected) +Skipped: 0 +Total: 1/1 + +Started at: @@TIMESTAMP@@ +Finished. +Finished at: @@TIMESTAMP@@ + +F + +F failing-test + (ert-test-failed + ((should (equal '((:one \"1\" :three \"3\" :two \"2\")) '((:one \"1\")))) + :form (equal ((:one \"1\" :three \"3\" :two \"2\")) ((:one \"1\"))) :value + nil :explanation + (list-elt 0 + (proper-lists-of-different-length 6 2 + (:one \"1\" :three \"3\" + :two \"2\") + (:one \"1\") + first-mismatch-at 2)))) +\n\n") + (want-msg "Ran 1 tests, 0 results were as expected, 1 unexpected") + (buffer-name (generate-new-buffer-name " *ert-test-run-tests*"))) + (cl-letf* ((ert-debug-on-error nil) + (ert--output-buffer-name buffer-name) + (messages nil) + ((symbol-function 'message) + (lambda (format-string &rest args) + (push (apply #'format format-string args) messages))) + ((symbol-function 'ert--format-time-iso8601) + (lambda (_) "@@TIMESTAMP@@"))) + (save-window-excursion + (unwind-protect + (let ((case-fold-search nil)) + (ert-run-tests-interactively failing-test) + (should (equal (list want-msg) messages)) + (should (equal (string-replace "\t" " " + (with-current-buffer buffer-name + (buffer-string))) + want-body))) + (when noninteractive + (kill-buffer buffer-name))))))) + (provide 'ert-tests) ;;; ert-tests.el ends here -- 2.46.0 --=-=-=-- From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Aug 2024 08:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "J.P." , Stefan Monnier Cc: 72561@debbugs.gnu.org Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.172371085922179 (code B ref 72561); Thu, 15 Aug 2024 08:35:01 +0000 Received: (at 72561) by debbugs.gnu.org; 15 Aug 2024 08:34:19 +0000 Received: from localhost ([127.0.0.1]:48314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seVw2-0005lf-Lu for submit@debbugs.gnu.org; Thu, 15 Aug 2024 04:34:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43288) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seVw0-0005lO-5t for 72561@debbugs.gnu.org; Thu, 15 Aug 2024 04:34:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seVvK-0005dg-Fg; Thu, 15 Aug 2024 04:33:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PgH34pTnkRIXNFQdVfsHmVPMVRS3nyF/erzsipR8bm8=; b=A3gZktYyvFhX E0ponQdRMYShgrz0LIoak2Zetp1QRtbVAmMs3dyr8lATYD3fC7xi3mckTdC+jrFx/mOflgmJe3UFs idh37I5j3eK8SCRTUrlZf0IakjZJveygedjQnfB3d6iOKiqPi8E7JHrU4peoRxXZDek7ZFlQwh9W8 NaEJrs0uw2z3KgcCfFNSW+NctC9zF/+UkIe7Yz16zYcGhi8xyTQTs7K13ZowM/2DyXj40HDeMDDPo 6CjthgJ2Fc9CnrAAlrnaACPCly6GpdRlLEJQFhCaLxrW3SvfipPQNFfMet1cBJ+P2WkTOnNWJW6BD XKy8wQpU5CO3sIUr9KKcmg==; Date: Thu, 15 Aug 2024 11:33:32 +0300 Message-Id: <86le0y6v8j.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87v808o5es.fsf@neverwas.me> (jp@neverwas.me) References: <87v808o5es.fsf@neverwas.me> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: "J.P." > Date: Sat, 10 Aug 2024 06:48:11 -0700 > > Tags: patch > > This apparently began after > > 2f181d60323bd9e0196775828de633100479f4c2 > Author: Stefan Monnier > AuthorDate: Fri Jun 16 13:35:06 2023 -0400 > CommitDate: Sat Jun 17 17:24:38 2023 -0400 > > pp.el (pp-fill): New default pp function > > 1 file changed, 90 insertions(+), 1 deletion(-) > lisp/emacs-lisp/pp.el | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++- > > So I guess it also affects Emacs 30. To reproduce, put this in > test/lisp/emacs-lisp/ert-tests.el: > > (ert-deftest ert--pp-with-indentation-and-newline () > (should (equal '((:one "1" :three "3" :two "2")) '((:one "1"))))) > > Then run something like: > > $ make -C test \ > SELECTOR=ert--pp-with-indentation-and-newline \ > lisp/emacs-lisp/ert-tests.log > > 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 > #f(compiled-function (event-type &rest event-args) # #f(compiled-function () #)() > ert-run-or-rerun-test(#s(ert--stats :selector ert--pp-with-indentati > > Aborted: Ran 1 tests, 0 results as expected, 1 unexpected, -1 skipped > > No idea if there's a deeper issue at play here, maybe something in > pp.el that a patch like the attached would just be papering over. Adding Stefan. From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Aug 2024 21:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "J.P." Cc: 72561@debbugs.gnu.org Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.17242765553115 (code B ref 72561); Wed, 21 Aug 2024 21:43:01 +0000 Received: (at 72561) by debbugs.gnu.org; 21 Aug 2024 21:42:35 +0000 Received: from localhost ([127.0.0.1]:36416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgt6A-0000oB-Ur for submit@debbugs.gnu.org; Wed, 21 Aug 2024 17:42:35 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33699) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgt68-0000nu-0C for 72561@debbugs.gnu.org; Wed, 21 Aug 2024 17:42:33 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B461180672; Wed, 21 Aug 2024 17:41:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1724276499; bh=1Pj30YA+ivx3g2rEF8QBoIKaZ0QwNRKC3zDrHIJciHo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=eg1QLtpTW8o1FO1UPC9V02JZDKiUfUsZQHW8+toOKEBymvfxWC4C+0OiX3+o92GPB 1sr3whGH3q2UEzRNrJETS1Hm1t640Hg4lnS5JBGedQTUg8Tz/Rf9XSu1riq7298Ij7 Try2s8I6AwgjOUnEXiegoICegTQYu+V/oxaVVj6OawgJP8wogcIb4xA5jVXgdWBJS3 XrY3N+pW1mpKN2HWZCMWXod2HYtXdbUOWwbJA/ezPA4yuKL1hE2N4gInf3ORfnV4pl nwt7TrSYU0UqjOxuRCIx8dS016xzzltgN/XWRpjkXx3swXOqKGhc1/KhQNb3WDbWxk +OaTn31f1v0ng== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3F5E6801F1; Wed, 21 Aug 2024 17:41:39 -0400 (EDT) Received: from asado (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 20E381203DF; Wed, 21 Aug 2024 17:41:39 -0400 (EDT) From: Stefan Monnier In-Reply-To: <87v808o5es.fsf@neverwas.me> (J. P.'s message of "Sat, 10 Aug 2024 06:48:11 -0700") Message-ID: References: <87v808o5es.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Wed, 21 Aug 2024 17:41:38 -0400 MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.533 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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 From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Aug 2024 00:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 72561@debbugs.gnu.org Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.172428658220447 (code B ref 72561); Thu, 22 Aug 2024 00:30:02 +0000 Received: (at 72561) by debbugs.gnu.org; 22 Aug 2024 00:29:42 +0000 Received: from localhost ([127.0.0.1]:36458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgvht-0005Jj-Eg for submit@debbugs.gnu.org; Wed, 21 Aug 2024 20:29:41 -0400 Received: from mail-108-mta124.mxroute.com ([136.175.108.124]:35769) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgvhr-0005JV-79 for 72561@debbugs.gnu.org; Wed, 21 Aug 2024 20:29:40 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta124.mxroute.com (ZoneMTA) with ESMTPSA id 191777c6ad00006bab.001 for <72561@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 22 Aug 2024 00:28:48 +0000 X-Zone-Loop: 2995338b5c237df4710695ef4ebc872e7f48eb03c049 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nj4Rs3CtIZD/pQ3/7fGJEgu14M9EHfSvsYAu/B3fsf8=; b=RZHEN2fjC3Y6ENIvFOOrZMTB1g 0pk9hTRm3DPWVAc3/uWfg+KCDjP2DQY/5YoLmmAyXnxFVZnEI47xFH8kMxLLTM+MaBd1xy20aAFM+ Zj6pHeDaOlzmAkt33UxTdOxPGywOeUxxbVbaptB/Ak7n8rtVZlxWnzz6yPrsYnXInrCxagVUH4pbJ tjtzXDq531bKKdcDlVbz6XLnuHw+WFJ9QL64k5/pVochUSusd3V27YmzLELyRmgHTaVKzU8MK3SWL TKRa/g2DGzBjj80oF0PUycTKaEdHSw9neSjOA4W5IqP6F4vjNFJkysE+Hj4RYjBJnz+qW9yO23xlk f69pcqWA==; From: "J.P." In-Reply-To: (Stefan Monnier's message of "Wed, 21 Aug 2024 17:41:38 -0400") References: <87v808o5es.fsf@neverwas.me> Date: Wed, 21 Aug 2024 17:28:45 -0700 Message-ID: <87zfp54czm.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Authenticated-Id: masked@neverwas.me X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Stefan Monnier writes: > 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? Right, I don't think `begin' is ever in column 0 (as currently used). So I guess the intention is indeed to shift all but the first line of the `pp' result by `current-column', meaning it's probably cleaner (as you say) to do a dumb, uniform shift. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Indent-ERT-failure-explanations-rigidly.patch >From ee67372f30150efef18284b0465f535891e68da9 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 9 Aug 2024 16:49:28 -0700 Subject: [PATCH] Indent ERT failure explanations rigidly * lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline): Indent uniformly from the line after point to the end of the pretty-printed result. * test/lisp/emacs-lisp/ert-tests.el (ert--pp-with-indentation-and-newline): New test. (Bug#72561) --- lisp/emacs-lisp/ert.el | 4 ++- test/lisp/emacs-lisp/ert-tests.el | 54 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 2d96e5ce5a9..a1c70aa1144 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1323,7 +1323,9 @@ ert--pp-with-indentation-and-newline (unless (bolp) (insert "\n")) (save-excursion (goto-char begin) - (indent-sexp)))) + (let ((cols (- (point) (line-beginning-position)))) + (forward-line) + (indent-rigidly begin (point-max) cols))))) (defun ert--insert-infos (result) "Insert `ert-info' infos from RESULT into current buffer. diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 1aff73d66f6..cdbeae2f2e5 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -876,6 +876,60 @@ ert-test-get-explainer (should (eq (ert--get-explainer 'string-equal) 'ert--explain-string-equal)) (should (eq (ert--get-explainer 'string=) 'ert--explain-string-equal))) +(ert-deftest ert--pp-with-indentation-and-newline () + :tags '(:causes-redisplay) + (let ((failing-test (make-ert-test + :name 'failing-test + :body (lambda () + (should (equal '((:one "1" :three "3" :two "2")) + '((:one "1"))))))) + (want-body "\ +Selector: +Passed: 0 +Failed: 1 (1 unexpected) +Skipped: 0 +Total: 1/1 + +Started at: @@TIMESTAMP@@ +Finished. +Finished at: @@TIMESTAMP@@ + +F + +F failing-test + (ert-test-failed + ((should (equal '((:one \"1\" :three \"3\" :two \"2\")) '((:one \"1\")))) + :form (equal ((:one \"1\" :three \"3\" :two \"2\")) ((:one \"1\"))) :value + nil :explanation + (list-elt 0 + (proper-lists-of-different-length 6 2 + (:one \"1\" :three \"3\" + :two \"2\") + (:one \"1\") + first-mismatch-at 2)))) +\n\n") + (want-msg "Ran 1 tests, 0 results were as expected, 1 unexpected") + (buffer-name (generate-new-buffer-name " *ert-test-run-tests*"))) + (cl-letf* ((ert-debug-on-error nil) + (ert--output-buffer-name buffer-name) + (messages nil) + ((symbol-function 'message) + (lambda (format-string &rest args) + (push (apply #'format format-string args) messages))) + ((symbol-function 'ert--format-time-iso8601) + (lambda (_) "@@TIMESTAMP@@"))) + (save-window-excursion + (unwind-protect + (let ((case-fold-search nil)) + (ert-run-tests-interactively failing-test) + (should (equal (list want-msg) messages)) + (should (equal (string-replace "\t" " " + (with-current-buffer buffer-name + (buffer-string))) + want-body))) + (when noninteractive + (kill-buffer buffer-name))))))) + (provide 'ert-tests) ;;; ert-tests.el ends here -- 2.46.0 --=-=-=-- From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Aug 2024 01:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 72561@debbugs.gnu.org Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.172428972725925 (code B ref 72561); Thu, 22 Aug 2024 01:23:02 +0000 Received: (at 72561) by debbugs.gnu.org; 22 Aug 2024 01:22:07 +0000 Received: from localhost ([127.0.0.1]:36470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgwWc-0006k4-TO for submit@debbugs.gnu.org; Wed, 21 Aug 2024 21:22:07 -0400 Received: from mail-108-mta117.mxroute.com ([136.175.108.117]:41771) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgwWY-0006jX-JU for 72561@debbugs.gnu.org; Wed, 21 Aug 2024 21:22:05 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta117.mxroute.com (ZoneMTA) with ESMTPSA id 19177ac6b2e0006bab.001 for <72561@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 22 Aug 2024 01:21:14 +0000 X-Zone-Loop: f528753453c83b466d15497ecf90106394f591391295 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6ySgEEP55tME7xocbrKTlF6feXeqsRJkMOpjQn3GL08=; b=Ky/WV12NGG6/SL8uMm5If1/2Cu XOzJkM8m7QvhFR79alFsVUfwunBRS1uxx3J8mi8upqKYBjlEYwxzKDwikd2xJXj69nhInWfIQOwRk dwCoEIm09fz6dInM1C5+Qz19GSqO+Uldmh78sVcxflTeI+vljnRUSFP9rDKmG+Lz11A/y0hSvRBFS JF26QI1xCKxWiOXnsoBm+FAgJFOMpVp8Cr7sEFzxoKcLeEfXD/oiq7tzFP5XTTGE6bRYOsm8gMD87 rHwshCX9oJ9cTd3MPYBDhAGl7ITnES4t/Ogft8J8GRZIpKPGDrSv5BXAU3ETqr3GWXcS/zTtxJZ4O cz41GEng==; From: "J.P." In-Reply-To: <87zfp54czm.fsf@neverwas.me> (J. P.'s message of "Wed, 21 Aug 2024 17:28:45 -0700") References: <87v808o5es.fsf@neverwas.me> <87zfp54czm.fsf@neverwas.me> Date: Wed, 21 Aug 2024 18:21:11 -0700 Message-ID: <87o75l4ak8.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Authenticated-Id: masked@neverwas.me X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain "J.P." writes: Actually, that can probably be simplified a bit. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Indent-ERT-failure-explanations-rigidly.patch >From e240ba51f780c84e57d3ba34ada83489149d371a Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 9 Aug 2024 16:49:28 -0700 Subject: [PATCH] Indent ERT failure explanations rigidly * lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline): Indent uniformly from the line after point to the end of the pretty-printed result. * test/lisp/emacs-lisp/ert-tests.el (ert--pp-with-indentation-and-newline): New test. (Bug#72561) --- lisp/emacs-lisp/ert.el | 5 ++- test/lisp/emacs-lisp/ert-tests.el | 54 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 2d96e5ce5a9..d4cc43d730d 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1317,13 +1317,12 @@ ert--pp-with-indentation-and-newline "Pretty-print OBJECT, indenting it to the current column of point. Ensures a final newline is inserted." (let ((begin (point)) + (cols (- (point) (line-beginning-position))) (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))) (defun ert--insert-infos (result) "Insert `ert-info' infos from RESULT into current buffer. diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 1aff73d66f6..cdbeae2f2e5 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -876,6 +876,60 @@ ert-test-get-explainer (should (eq (ert--get-explainer 'string-equal) 'ert--explain-string-equal)) (should (eq (ert--get-explainer 'string=) 'ert--explain-string-equal))) +(ert-deftest ert--pp-with-indentation-and-newline () + :tags '(:causes-redisplay) + (let ((failing-test (make-ert-test + :name 'failing-test + :body (lambda () + (should (equal '((:one "1" :three "3" :two "2")) + '((:one "1"))))))) + (want-body "\ +Selector: +Passed: 0 +Failed: 1 (1 unexpected) +Skipped: 0 +Total: 1/1 + +Started at: @@TIMESTAMP@@ +Finished. +Finished at: @@TIMESTAMP@@ + +F + +F failing-test + (ert-test-failed + ((should (equal '((:one \"1\" :three \"3\" :two \"2\")) '((:one \"1\")))) + :form (equal ((:one \"1\" :three \"3\" :two \"2\")) ((:one \"1\"))) :value + nil :explanation + (list-elt 0 + (proper-lists-of-different-length 6 2 + (:one \"1\" :three \"3\" + :two \"2\") + (:one \"1\") + first-mismatch-at 2)))) +\n\n") + (want-msg "Ran 1 tests, 0 results were as expected, 1 unexpected") + (buffer-name (generate-new-buffer-name " *ert-test-run-tests*"))) + (cl-letf* ((ert-debug-on-error nil) + (ert--output-buffer-name buffer-name) + (messages nil) + ((symbol-function 'message) + (lambda (format-string &rest args) + (push (apply #'format format-string args) messages))) + ((symbol-function 'ert--format-time-iso8601) + (lambda (_) "@@TIMESTAMP@@"))) + (save-window-excursion + (unwind-protect + (let ((case-fold-search nil)) + (ert-run-tests-interactively failing-test) + (should (equal (list want-msg) messages)) + (should (equal (string-replace "\t" " " + (with-current-buffer buffer-name + (buffer-string))) + want-body))) + (when noninteractive + (kill-buffer buffer-name))))))) + (provide 'ert-tests) ;;; ert-tests.el ends here -- 2.46.0 --=-=-=-- From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Aug 2024 13:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "J.P." Cc: 72561@debbugs.gnu.org Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.172433424910424 (code B ref 72561); Thu, 22 Aug 2024 13:45:02 +0000 Received: (at 72561) by debbugs.gnu.org; 22 Aug 2024 13:44:09 +0000 Received: from localhost ([127.0.0.1]:37071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sh86j-0002i4-3W for submit@debbugs.gnu.org; Thu, 22 Aug 2024 09:44:09 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sh86h-0002hk-DZ for 72561@debbugs.gnu.org; Thu, 22 Aug 2024 09:44:08 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3AC9110017F; Thu, 22 Aug 2024 09:43:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1724334195; bh=m7BkKoxkvBbCiyKyWeexKiVOwfjO/U6BkNZaXw8Y4I0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LML2H/MggVLRysmIbHr6SpVpzdROa8ecMVVskobZ1Ke3DNELJMZtx1J4j3NEXDV38 RMoamdC8x4lbiQse5DTmEmmDQ8ARdBr0NsNinniuj5EuC+QQWwDTQPI1e4h95/1bVu c/RjvWTb+dtnN5DzEabtPANxhQFnWIg0/T+uze/sTUTz44nZXLoltnhULfucHK7Wkw Lvj7Bx4+lNiR5BGCalp8HRlLYl+HP57lINTixuGrOP5jiTKcNQpP6MOoXDV1ZzcTEf I6Xw3TcSZFTgqrEGR4f083gS/vlOKZSQhonZFxgbV+zeWtelX9R5f/DDzaMoawLLTR mGa/j5cN65tUw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id F0C4A100044; Thu, 22 Aug 2024 09:43:14 -0400 (EDT) Received: from asado (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D5CF8120480; Thu, 22 Aug 2024 09:43:14 -0400 (EDT) From: Stefan Monnier In-Reply-To: <87o75l4ak8.fsf@neverwas.me> (J. P.'s message of "Wed, 21 Aug 2024 18:21:11 -0700") Message-ID: References: <87v808o5es.fsf@neverwas.me> <87zfp54czm.fsf@neverwas.me> <87o75l4ak8.fsf@neverwas.me> Date: Thu, 22 Aug 2024 09:43:14 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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 From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2024 01:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: Eli Zaretskii , 72561@debbugs.gnu.org Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.172437500118484 (code B ref 72561); Fri, 23 Aug 2024 01:04:01 +0000 Received: (at 72561) by debbugs.gnu.org; 23 Aug 2024 01:03:21 +0000 Received: from localhost ([127.0.0.1]:38592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shIi0-0004o4-F0 for submit@debbugs.gnu.org; Thu, 22 Aug 2024 21:03:20 -0400 Received: from mail-108-mta195.mxroute.com ([136.175.108.195]:46373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shIhx-0004ns-4y for 72561@debbugs.gnu.org; Thu, 22 Aug 2024 21:03:19 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta195.mxroute.com (ZoneMTA) with ESMTPSA id 1917cc18b8f0003e01.001 for <72561@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 23 Aug 2024 01:02:24 +0000 X-Zone-Loop: f573b8235e25df0298cd7108061e0c3fd05ce2d008b8 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BXvLcweiHwfwvlRsBE5Z4UooIzseGGIJDyQhmz9Yi/4=; b=JLLIuA31S68dZ/gXhaTte202TJ x9gQAe6qaMThlBCPRSrCRv9hFLb/Xpais1QK/7paXe9ihNKrhAOn/WNHUO/bnJtYFeY3TYPoziIpP BGisL+8N4aaFPmPKpp2Q2LZ8LKEYgWz/nVdkjN3TmMaWw7zfa+OKG5oYGCXueMiI22WZNt7KDHIh5 wS8zuK58lsS+F0fcXXRgyvUjlFuGuSl0Gz8LZNKaonJwU/Ky2FEH6mCeQ51aQ563es/gQpaKYhzP9 E9jJxAOBtmt3S0fW4Ehw4QbyEcxP5nSTIgJo0n8EasR/VCE15NyguFfdiV+EOY+4YTg++6egrSN2l 6QE7j29g==; From: "J.P." In-Reply-To: (Stefan Monnier's message of "Thu, 22 Aug 2024 09:43:14 -0400") References: <87v808o5es.fsf@neverwas.me> <87zfp54czm.fsf@neverwas.me> <87o75l4ak8.fsf@neverwas.me> Date: Thu, 22 Aug 2024 18:02:20 -0700 Message-ID: <87o75k2grn.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Authenticated-Id: masked@neverwas.me X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Stefan Monnier writes: >> 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) Oh, TABs and stuff, right. > >> (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. Makes sense. Might as well have the function be more generally useful. Thanks. And since the issue is new on the release branch, I'm guessing that's where a patch should go (Cc. Eli)? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Indent-ERT-failure-explanations-rigidly.patch >From 99196569034bb6447f8d583b19f53e21e51ade56 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 9 Aug 2024 16:49:28 -0700 Subject: [PATCH] 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 ++- test/lisp/emacs-lisp/ert-tests.el | 54 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) 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 @@ ert--pp-with-indentation-and-newline "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. diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 1aff73d66f6..cdbeae2f2e5 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -876,6 +876,60 @@ ert-test-get-explainer (should (eq (ert--get-explainer 'string-equal) 'ert--explain-string-equal)) (should (eq (ert--get-explainer 'string=) 'ert--explain-string-equal))) +(ert-deftest ert--pp-with-indentation-and-newline () + :tags '(:causes-redisplay) + (let ((failing-test (make-ert-test + :name 'failing-test + :body (lambda () + (should (equal '((:one "1" :three "3" :two "2")) + '((:one "1"))))))) + (want-body "\ +Selector: +Passed: 0 +Failed: 1 (1 unexpected) +Skipped: 0 +Total: 1/1 + +Started at: @@TIMESTAMP@@ +Finished. +Finished at: @@TIMESTAMP@@ + +F + +F failing-test + (ert-test-failed + ((should (equal '((:one \"1\" :three \"3\" :two \"2\")) '((:one \"1\")))) + :form (equal ((:one \"1\" :three \"3\" :two \"2\")) ((:one \"1\"))) :value + nil :explanation + (list-elt 0 + (proper-lists-of-different-length 6 2 + (:one \"1\" :three \"3\" + :two \"2\") + (:one \"1\") + first-mismatch-at 2)))) +\n\n") + (want-msg "Ran 1 tests, 0 results were as expected, 1 unexpected") + (buffer-name (generate-new-buffer-name " *ert-test-run-tests*"))) + (cl-letf* ((ert-debug-on-error nil) + (ert--output-buffer-name buffer-name) + (messages nil) + ((symbol-function 'message) + (lambda (format-string &rest args) + (push (apply #'format format-string args) messages))) + ((symbol-function 'ert--format-time-iso8601) + (lambda (_) "@@TIMESTAMP@@"))) + (save-window-excursion + (unwind-protect + (let ((case-fold-search nil)) + (ert-run-tests-interactively failing-test) + (should (equal (list want-msg) messages)) + (should (equal (string-replace "\t" " " + (with-current-buffer buffer-name + (buffer-string))) + want-body))) + (when noninteractive + (kill-buffer buffer-name))))))) + (provide 'ert-tests) ;;; ert-tests.el ends here -- 2.46.0 --=-=-=-- From unknown Fri Sep 05 11:00:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2024 06:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: "J.P." Cc: 72561@debbugs.gnu.org, monnier@iro.umontreal.ca Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.172439488621085 (code B ref 72561); Fri, 23 Aug 2024 06:35:01 +0000 Received: (at 72561) by debbugs.gnu.org; 23 Aug 2024 06:34:46 +0000 Received: from localhost ([127.0.0.1]:38737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shNsj-0005U1-OU for submit@debbugs.gnu.org; Fri, 23 Aug 2024 02:34:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shNsh-0005Tn-9K for 72561@debbugs.gnu.org; Fri, 23 Aug 2024 02:34:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shNpj-0006GD-5C; Fri, 23 Aug 2024 02:31:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=CO9k3zoHAvl0xvFWve6ztbgufRWZ101bJyzWsNhhjaE=; b=k4uklLOyQVJR sPvOh40tUrRi+vo3lb3C6JKuNFWr3hHcbDUWCA4ojratHIm3VK5lnOwXoqwaokdElsAGF20vqEEoC XoMc9XIlyBUjkqXYgyYAYovkypiMifTsCZb2/QYcBxrKaOzLNcz6TcCTHIKoonA7rabVRURCiQC9z dczfnnzaSKGJJMakNTmhVtkwLgi4ckCOQ7Aiy0OSyb8uGe3wWi9Gdc8HC2EDYyF6JH1MtEAct6ku9 zVKYfj2meMRbBP8cZ1ATfwpIRrc3JgtL1kqORAUXmjZYO5KgG0HfYg342XLmx8G037nCnZXDKx2Yq OSXTj03CgQ9lXKH4Yu4/CQ==; Date: Fri, 23 Aug 2024 09:31:24 +0300 Message-Id: <86o75jrbr7.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87o75k2grn.fsf@neverwas.me> (jp@neverwas.me) References: <87v808o5es.fsf@neverwas.me> <87zfp54czm.fsf@neverwas.me> <87o75l4ak8.fsf@neverwas.me> <87o75k2grn.fsf@neverwas.me> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: "J.P." > Cc: 72561@debbugs.gnu.org, Eli Zaretskii > Date: Thu, 22 Aug 2024 18:02:20 -0700 > > And since the issue is new on the release branch, I'm guessing that's > where a patch should go (Cc. Eli)? If you run the entire test suite, including the expensive tests, and this doesn't change the results, then yes, please install on the release branch. Thanks. From unknown Fri Sep 05 11:00:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "J.P." Subject: bug#72561: closed (Re: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline) Message-ID: References: <87bk1c0z1a.fsf@neverwas.me> <87v808o5es.fsf@neverwas.me> X-Gnu-PR-Message: they-closed 72561 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 72561@debbugs.gnu.org Date: Thu, 29 Aug 2024 03:50:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1724903402-27448-1" This is a multi-part message in MIME format... ------------=_1724903402-27448-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 72561@debbugs.gnu.org. --=20 72561: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72561 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1724903402-27448-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 72561-done) by debbugs.gnu.org; 29 Aug 2024 03:49:56 +0000 Received: from localhost ([127.0.0.1]:49992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjWAW-00078J-5Q for submit@debbugs.gnu.org; Wed, 28 Aug 2024 23:49:56 -0400 Received: from mail-108-mta231.mxroute.com ([136.175.108.231]:38461) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjWAT-000788-8z for 72561-done@debbugs.gnu.org; Wed, 28 Aug 2024 23:49:55 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta231.mxroute.com (ZoneMTA) with ESMTPSA id 1919c401a780003e01.001 for <72561-done@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 29 Aug 2024 03:48:52 +0000 X-Zone-Loop: 01cc454ceafb1a2f4f5054127d9a512ce1d3c2b9e1ed X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=XLasoxlVv3HV/+JL7wb0XoO+GzRUIONp8O4FJE78sdk=; b=g4h8taaYVPsM8xRaQsrWndwMb0 8roOFO2VB4rdfPSBMxwujPcnBpKOP8AXBP7fY1apd3OynGweRtGMTnEjpE24A+3FjT6adA35/saK6 9qsTLiojpkcKrwgQSffoR3u12AFHhbnyTHYs7TJUZBowIjSgy50PWpNRBHMldBNhALB+WtPWBTQAC BmEcCD57Jn6p54j89dDtdlfonzW9B51I4+RqaFQWF8hrQsI+MDoVux3/D7S66eBq2Nh+Gnx8zdjiu 9BTirVhpbRx6G1YLV+zMx47+rclFpdgpwBxeeDGs4Yhn5K2hlpX5ukX6HLZ+qHBSfgkqEX1SDivlg HNjUkGrg==; From: "J.P." To: 72561-done@debbugs.gnu.org Subject: Re: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline In-Reply-To: <86o75jrbr7.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 23 Aug 2024 09:31:24 +0300") References: <87v808o5es.fsf@neverwas.me> <87zfp54czm.fsf@neverwas.me> <87o75l4ak8.fsf@neverwas.me> <87o75k2grn.fsf@neverwas.me> <86o75jrbr7.fsf@gnu.org> Date: Wed, 28 Aug 2024 20:48:49 -0700 Message-ID: <87bk1c0z1a.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Id: masked@neverwas.me X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72561-done Cc: Eli Zaretskii , monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > If you run the entire test suite, including the expensive tests, and > this doesn't change the results, then yes, please install on the > release branch. Results for check-expensive were stable, running locally in EMBA's inotify and native-comp containers. The changes were therefore installed on the release branch. Thanks and closing. ------------=_1724903402-27448-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 10 Aug 2024 13:54:04 +0000 Received: from localhost ([127.0.0.1]:39214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scmXj-0007Hx-GG for submit@debbugs.gnu.org; Sat, 10 Aug 2024 09:54:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:49948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scmXe-0007HW-Ut for submit@debbugs.gnu.org; Sat, 10 Aug 2024 09:54:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scmXA-0003fL-Bp for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 09:53:29 -0400 Received: from mail-108-mta130.mxroute.com ([136.175.108.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1scmX7-0007t5-RU for bug-gnu-emacs@gnu.org; Sat, 10 Aug 2024 09:53:28 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta130.mxroute.com (ZoneMTA) with ESMTPSA id 1913c8c01df0000a78.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 10 Aug 2024 13:48:14 +0000 X-Zone-Loop: 65210683b5fc42461ad170d76efe1b523d973a7eca96 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ELEZCJ5qX69gz1gSViH5TePMVj9kLF97OSLxqs4i9rY=; b=WJvyhsjESJk2tuCqj3LfjftC+o znOAWgVejEH6XJGMsiOs2B5+6gcZVNliIqJnEdbsrhoQqweMlTg/lzEfn+av+cCX7LxqeKARWDL9A sVFWu5Eag93m/2dYjSpbNom+bAFatvtkFreIKNLUXi0KZs7FuTCJ+HaJt84gZeFP1KTQc8LOlOYPu 4f/BODTFIzX6/2nRADe8PUoI9K1I2osyeNzETQVVLgtuXUwZxBbJBTg+1VZal1wZQUruEjMtAUcr4 0PkC9hgEljvbiLphJdI2PMzEfOI7cdE5LodikAtNSP1zHWkhk+JCzdPcCZZ4XUUrxsAXRNp9gG9IM 6aVSmc+w==; From: "J.P." To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Date: Sat, 10 Aug 2024 06:48:11 -0700 Message-ID: <87v808o5es.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Authenticated-Id: masked@neverwas.me Received-SPF: pass client-ip=136.175.108.130; envelope-from=jp@neverwas.me; helo=mail-108-mta130.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch This apparently began after 2f181d60323bd9e0196775828de633100479f4c2 Author: Stefan Monnier AuthorDate: Fri Jun 16 13:35:06 2023 -0400 CommitDate: Sat Jun 17 17:24:38 2023 -0400 pp.el (pp-fill): New default pp function 1 file changed, 90 insertions(+), 1 deletion(-) lisp/emacs-lisp/pp.el | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++- So I guess it also affects Emacs 30. To reproduce, put this in test/lisp/emacs-lisp/ert-tests.el: (ert-deftest ert--pp-with-indentation-and-newline () (should (equal '((:one "1" :three "3" :two "2")) '((:one "1"))))) Then run something like: $ make -C test \ SELECTOR=ert--pp-with-indentation-and-newline \ lisp/emacs-lisp/ert-tests.log 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 #f(compiled-function (event-type &rest event-args) #)() ert-run-or-rerun-test(#s(ert--stats :selector ert--pp-with-indentati Aborted: Ran 1 tests, 0 results as expected, 1 unexpected, -1 skipped No idea if there's a deeper issue at play here, maybe something in pp.el that a patch like the attached would just be papering over. In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-08-09 built on localhost Repository revision: 944e45db53cb173c5eadd4794081c133e8649d67 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12401002 System Description: Fedora Linux 40 (Workstation Edition) Configured using: 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3' PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run bytecomp byte-compile comp-common rx emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar make-network-process native-compile emacs) Memory information: ((conses 16 58857 9185) (symbols 48 6741 0) (strings 32 16558 3964) (string-bytes 1 477530) (vectors 16 11257) (vector-slots 8 135809 8706) (floats 8 21 4) (intervals 56 249 0) (buffers 984 11)) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Indent-failed-ERT-should-forms-with-Emacs-Lisp-synta.patch >From 2a65e655ae62c1ee74a15747c228b3c19a871f9e Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 9 Aug 2024 16:49:28 -0700 Subject: [PATCH] Indent failed ERT should forms with Emacs Lisp syntax * lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline): Use `emacs-lisp-mode-syntax-table' when indenting. * test/lisp/emacs-lisp/ert-tests.el (ert--pp-with-indentation-and-newline): New test. --- lisp/emacs-lisp/ert.el | 3 +- test/lisp/emacs-lisp/ert-tests.el | 54 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 6a665c8181d..6f5a0093ba0 100644 --- 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))))) (defun ert--insert-infos (result) "Insert `ert-info' infos from RESULT into current buffer. diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index 1aff73d66f6..cdbeae2f2e5 100644 --- a/test/lisp/emacs-lisp/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -876,6 +876,60 @@ ert-test-get-explainer (should (eq (ert--get-explainer 'string-equal) 'ert--explain-string-equal)) (should (eq (ert--get-explainer 'string=) 'ert--explain-string-equal))) +(ert-deftest ert--pp-with-indentation-and-newline () + :tags '(:causes-redisplay) + (let ((failing-test (make-ert-test + :name 'failing-test + :body (lambda () + (should (equal '((:one "1" :three "3" :two "2")) + '((:one "1"))))))) + (want-body "\ +Selector: +Passed: 0 +Failed: 1 (1 unexpected) +Skipped: 0 +Total: 1/1 + +Started at: @@TIMESTAMP@@ +Finished. +Finished at: @@TIMESTAMP@@ + +F + +F failing-test + (ert-test-failed + ((should (equal '((:one \"1\" :three \"3\" :two \"2\")) '((:one \"1\")))) + :form (equal ((:one \"1\" :three \"3\" :two \"2\")) ((:one \"1\"))) :value + nil :explanation + (list-elt 0 + (proper-lists-of-different-length 6 2 + (:one \"1\" :three \"3\" + :two \"2\") + (:one \"1\") + first-mismatch-at 2)))) +\n\n") + (want-msg "Ran 1 tests, 0 results were as expected, 1 unexpected") + (buffer-name (generate-new-buffer-name " *ert-test-run-tests*"))) + (cl-letf* ((ert-debug-on-error nil) + (ert--output-buffer-name buffer-name) + (messages nil) + ((symbol-function 'message) + (lambda (format-string &rest args) + (push (apply #'format format-string args) messages))) + ((symbol-function 'ert--format-time-iso8601) + (lambda (_) "@@TIMESTAMP@@"))) + (save-window-excursion + (unwind-protect + (let ((case-fold-search nil)) + (ert-run-tests-interactively failing-test) + (should (equal (list want-msg) messages)) + (should (equal (string-replace "\t" " " + (with-current-buffer buffer-name + (buffer-string))) + want-body))) + (when noninteractive + (kill-buffer buffer-name))))))) + (provide 'ert-tests) ;;; ert-tests.el ends here -- 2.46.0 --=-=-=-- ------------=_1724903402-27448-1--