From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62031: 29.0.60; python-mode indentation after re.match Date: Wed, 08 Mar 2023 15:54:03 +0200 Message-ID: <83wn3r4adg.fsf@gnu.org> References: <5ea3a37a-4e43-4ede-9f96-7159f54272e8@yandex.ru> <87bkl4y5gw.fsf@metapensiero.it> <87wn3rk7bk.fsf@metapensiero.it> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4666"; mail-complaints-to="usenet@ciao.gmane.io" Cc: robm.dev@gmail.com, dgutov@yandex.ru, 62031@debbugs.gnu.org To: Lele Gaifax , kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 08 14:55:48 2023 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 1pZuGe-0000tD-Il for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Mar 2023 14:55:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZuG0-0008Kt-2F; Wed, 08 Mar 2023 08:55:04 -0500 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 1pZuFy-0008KI-2V for bug-gnu-emacs@gnu.org; Wed, 08 Mar 2023 08:55:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZuFx-0003Us-Q2 for bug-gnu-emacs@gnu.org; Wed, 08 Mar 2023 08:55:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pZuFx-0004V0-Lv for bug-gnu-emacs@gnu.org; Wed, 08 Mar 2023 08:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Mar 2023 13:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62031 X-GNU-PR-Package: emacs Original-Received: via spool by 62031-submit@debbugs.gnu.org id=B62031.167828365317223 (code B ref 62031); Wed, 08 Mar 2023 13:55:01 +0000 Original-Received: (at 62031) by debbugs.gnu.org; 8 Mar 2023 13:54:13 +0000 Original-Received: from localhost ([127.0.0.1]:48079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZuFB-0004Tj-9e for submit@debbugs.gnu.org; Wed, 08 Mar 2023 08:54:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZuF9-0004TW-0j for 62031@debbugs.gnu.org; Wed, 08 Mar 2023 08:54:11 -0500 Original-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 1pZuF2-0003MH-NG; Wed, 08 Mar 2023 08:54:04 -0500 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=/kctGSb8IJZZtu6QZR94XtKLgB91Jlncx+9Wjhkl3/I=; b=XcGcY/AhGfpL TzuWMJ5JmrV0+t29RyHFrf2gXnx6YAIY10sX7vYonISUuoT1wgGOpxm/IzQZsiu1HwKZYsWCkhU03 fKvv4DBfo6CBknyI8/dmoyoILWzeZi/dxgARiLDzsdAIN0Sgpw/7gn9O3Fln89ahrhADFC9p2GKj3 8XkaCqW8wsXLAltQKvnTbH9OL+2nWzGXUXItIoMbrwhP4fvFU8/QcA1Ezs8mI0dVK/1OJySnsywBL OnegMe19ZFnsVyn4m9E6Tlv2wzAhrrBty2Ks+/5Pm+FmuHRIKEsNIBGB7i9YlnKDpnR/abudPt52p wxpDSyTGVr6ggvXFKT1GCA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZuF1-0003wT-UK; Wed, 08 Mar 2023 08:54:04 -0500 In-Reply-To: <87wn3rk7bk.fsf@metapensiero.it> (message from Lele Gaifax on Wed, 08 Mar 2023 08:53:19 +0100) 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:257535 Archived-At: > Cc: Rob Moss , Dmitry Gutov > From: Lele Gaifax > Date: Wed, 08 Mar 2023 08:53:19 +0100 > > I had a quick glance at this, and while I can confirm the problem with > the following test > > diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el > index 4f24c042c6a..9926c4b002f 100644 > --- a/test/lisp/progmodes/python-tests.el > +++ b/test/lisp/progmodes/python-tests.el > @@ -1982,6 +1982,17 @@ python-virt-bin > (should (eq (car (python-indent-context)) :after-block-start)) > (should (= (python-indent-calculate-indentation) 8)))) > > +(ert-deftest python-indent-after-re-match () > + "Test BUG 62031 regression." > + (python-tests-with-temp-buffer > + " > +def test_re(string): > + if re.match('^[a-c]+$', string): > + print('yes') > + else: > +" > + (python-tests-look-at "else:") > + (should (= (python-indent-calculate-indentation) 4)))) > > I could not figure out how this can be fixed, with my current knowledge > on python.el. > > There are several places where the regexp produced by `(python-rx > block-start)' is used, many within a `(looking-at ...)' form and several > others in a `(re-search-forward ...)': given that block starting > "keywords" are required to be at the beginning of a line, possibly > preceded by whitespace, I think that the problem may arise from those > usages which do not explicitly enforce the constraint, but unfortunately > all my attempts to do that a) didn't make the test above green and b) > broke one or more of the other tests. > > I will try again, but I'm afraid this will go beyond my current spare > time availability. Thank you for your efforts. kobarity, any ideas or suggestions?