From: Dmitry Gutov <dgutov@yandex.ru>
To: Rob Moss <robm.dev@gmail.com>,
62031@debbugs.gnu.org, Lele Gaifax <lele@metapensiero.it>
Subject: bug#62031: 29.0.60; python-mode indentation after re.match
Date: Tue, 7 Mar 2023 16:35:23 +0200 [thread overview]
Message-ID: <5ea3a37a-4e43-4ede-9f96-7159f54272e8@yandex.ru> (raw)
In-Reply-To: <CAHh4uGQAi5PTWqDVRrTLTiigD51bZq4GxV4zG61k0z6svHPv_g@mail.gmail.com>
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 <TAB>.
>
> 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 <TAB> 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 <lele@metapensiero.it>
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.
next prev parent reply other threads:[~2023-03-07 14:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 4:44 bug#62031: 29.0.60; python-mode indentation after re.match Rob Moss
2023-03-07 14:35 ` Dmitry Gutov [this message]
2023-03-07 14:57 ` Lele Gaifax
2023-03-07 23:31 ` Rob Moss
2023-03-08 7:53 ` Lele Gaifax
2023-03-08 13:23 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-08 22:46 ` Dmitry Gutov
2023-03-09 2:31 ` Rob Moss
2023-03-08 13:54 ` Eli Zaretskii
2023-03-08 17:57 ` Dmitry Gutov
2023-03-08 18:10 ` Lele Gaifax
2023-03-08 20:52 ` Dmitry Gutov
2023-03-09 3:04 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-09 15:29 ` kobarity
2023-03-09 15:42 ` Dmitry Gutov
2023-03-09 15:44 ` Lele Gaifax
2023-03-09 15:40 ` Dmitry Gutov
2023-03-08 18:15 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ea3a37a-4e43-4ede-9f96-7159f54272e8@yandex.ru \
--to=dgutov@yandex.ru \
--cc=62031@debbugs.gnu.org \
--cc=lele@metapensiero.it \
--cc=robm.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.