From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#62031: 29.0.60; python-mode indentation after re.match Date: Tue, 7 Mar 2023 16:35:23 +0200 Message-ID: <5ea3a37a-4e43-4ede-9f96-7159f54272e8@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23957"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 To: Rob Moss , 62031@debbugs.gnu.org, Lele Gaifax Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 07 15:36:27 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 1pZYQU-0005z2-Ru for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Mar 2023 15:36:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZYQ7-0002ur-F8; Tue, 07 Mar 2023 09:36:03 -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 1pZYQ6-0002ug-7C for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2023 09:36: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 1pZYQ5-0000Bh-Vi for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2023 09:36:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pZYQ5-0005Kn-Rb for bug-gnu-emacs@gnu.org; Tue, 07 Mar 2023 09:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Mar 2023 14:36: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.167819973420456 (code B ref 62031); Tue, 07 Mar 2023 14:36:01 +0000 Original-Received: (at 62031) by debbugs.gnu.org; 7 Mar 2023 14:35:34 +0000 Original-Received: from localhost ([127.0.0.1]:44942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZYPe-0005Jr-DA for submit@debbugs.gnu.org; Tue, 07 Mar 2023 09:35:34 -0500 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:40870) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZYPc-0005Ja-3w for 62031@debbugs.gnu.org; Tue, 07 Mar 2023 09:35:33 -0500 Original-Received: by mail-wr1-f47.google.com with SMTP id t15so12326329wrz.7 for <62031@debbugs.gnu.org>; Tue, 07 Mar 2023 06:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678199726; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=f3v4U9EjovubsOsmXs2NUTlYvljPJ1XrXMp+3/ehu20=; b=dRqzyLivSvmVfiVPd4Vkvj9jndhrnxUXGVhD9uNTkPR8npG0H3akYQgl/7u+oPu6Rc ITlqf65meRdpJ+sTWoyhbnQX94S00b2D9JkdeJUVEa8PjUYRU2UntN9qAvbTHMnfdBbQ xzadC17B169S2OYvULz1WB977qgtjB/DcuHkUkEDhRqa2B7k0iCZ1SX1BY4K5pLZGmMJ dRrPwKNbl+ZZSiOOl/1OuFOAORbERaeTngatVDtkZLZuFKN9MVBW4buFfn2xO+p8KkFH yqgI4/6GS8VO5Wgp8iGOwkvu/HwfqHNo70+8etdZ/2oXhTR+R+q9Y2mZaETg1oJBahoZ bBXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678199726; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f3v4U9EjovubsOsmXs2NUTlYvljPJ1XrXMp+3/ehu20=; b=Oq+J4V0/6KUu5688zIkP/6MPlgpeC5KKLPt2zM43v9QBvOaLKzirdc1oOdOaBdOvj1 AmtuU0R4hZtAYXXkESNSxUe4KdSiK+0aUDBw8JET9ZU9/yPivWigEDvEpcn7gASKND11 GO76Dq79APsbzz6fbEaR7dduIwRYKGmSt7LZ8YA+oK6YDTLK5Oz+3xev9glJFHitV/2I 4SDyZMuJomlfhEp+AxGXclnOTSXBt4OT4gSSURipjnZrQXmi4nbDkmmea4gQBHpT4udN yRYErLUCjYnGBPLsk64EhC9luv/qRMJbjiNiYJ1zI8AeGyHBW1E4PKHMlhIGTSAFfvDR 0kSw== X-Gm-Message-State: AO0yUKV3RZyYrT2v4JH1W83Ps2nKPtkWdhWHiYTY1Bmqk2pa6Fyn9Dya UquPWEiAqUo091S7PnqNsQ4= X-Google-Smtp-Source: AK7set80dYUuVxoBbKtRHxn+dNziwJ+4R8A/eHgCFoQBsuAC3LlnAfc3hMJQElWPcwH5hb7NI1Wxlw== X-Received: by 2002:a5d:6689:0:b0:2c7:a39:7453 with SMTP id l9-20020a5d6689000000b002c70a397453mr10006803wru.54.1678199726048; Tue, 07 Mar 2023 06:35:26 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id j2-20020a5d6042000000b002c70d269b4esm12536196wrt.91.2023.03.07.06.35.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Mar 2023 06:35:25 -0800 (PST) Content-Language: en-US In-Reply-To: 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:257468 Archived-At: Hi! Thanks for the report. On 07/03/2023 06:44, Rob Moss wrote: > Hi there, > > Starting from 'emacs -Q' I do the following: > > 1. Visit a new Python file ("~/test.py", say); > > 2. Enter the following lines: > > ---------------------------------------- > import re > > def test_re(string): > if re.match('^[a-c]+$', string): > print('yes') > else: > print('no') > ---------------------------------------- > > 3. Place the cursor on the "else:" line and press . > > This has the following effect on the buffer contents: > > ---------------------------------------- > import re > > def test_re(string): > if re.match('^[a-c]+$', string): > print('yes') > else: > print('no') > ---------------------------------------- > > Pressing repeatedly has no effect, this incorrect indentation is > the only indentation it allows. > > I experience this issue with "python-mode" and "python-ts-mode", but > if I change "re.match" to "re.matches", the correct indentation is > preserved. So presumably the "match" in "re.match" is being treated as > a match statement. In python-mode, this is a regression from commit 35d0190b0b91c085c73bbe6c2b8e93ea8288b589 Author: Lele Gaifax Date: Sun May 22 10:44:31 2022 +0200 Properly indent Python PEP634 match/case blocks <...> The addition of "match" in python-rx has that effect. How to fix this without reverting the feature, is not immediately obvious to me, so I'm Cc'ing the author of that commit. python-ts-mode reuses indentation code from python-mode, so it's no coincidence that is shares the problem.