From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72561: 31.0.50; Scan error in ert--pp-with-indentation-and-newline Date: Wed, 21 Aug 2024 17:41:38 -0400 Message-ID: References: <87v808o5es.fsf@neverwas.me> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6968"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72561@debbugs.gnu.org To: "J.P." Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 21 23:42:43 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgt6I-0001fV-Tx for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Aug 2024 23:42:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgt5x-0003g4-98; Wed, 21 Aug 2024 17:42:21 -0400 Original-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 1sgt5u-0003fZ-GW for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2024 17:42:18 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgt5s-0006st-Vc for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2024 17:42:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=YrY5K1Ayh4Bwwgy8+d/xTO+RZ4VW0q4RL02kHa7nBJI=; b=i0mknGhyl+eyKtot3BAatCgn3JMtZvFqKcY/t6nuCog510VceOkHa3gfjfN9ANd8O7vlAyIK6oSrcksSsVvcRXWyV0jMVaVDqFANjKQ/+O4hXxyFc/dL7hiBvVMqgNbtuOBYBv1/+S+4EfajPfW1M4jP+RMuJO0wb0IF+WMjJ8ZihHU1n2o/vd94ZYZ7omIe96fGsDhScxanXMLHj7wJS1c3NTo/P4gWAT/Yf8HI64uUk6RzQplGYEWmA0MDEY8syUQ7WIwWLaMxN0GbtkU1FoTwTY0oCBE6QpCF8wDWLhyeSnA98alkmTFQBhcMVYHO0LAz61Nb5Jbxwuqw+ptbuA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sgt6b-0000ow-K0 for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2024 17:43:01 -0400 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 72561-submit@debbugs.gnu.org id=B72561.17242765553115 (code B ref 72561); Wed, 21 Aug 2024 21:43:01 +0000 Original-Received: (at 72561) by debbugs.gnu.org; 21 Aug 2024 21:42:35 +0000 Original-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 Original-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 Original-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== Original-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) Original-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) In-Reply-To: <87v808o5es.fsf@neverwas.me> (J. P.'s message of "Sat, 10 Aug 2024 06:48:11 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290504 Archived-At: > 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