unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lele Gaifax <lele@metapensiero.it>, kobarity <kobarity@gmail.com>
Cc: robm.dev@gmail.com, dgutov@yandex.ru, 62031@debbugs.gnu.org
Subject: bug#62031: 29.0.60; python-mode indentation after re.match
Date: Wed, 08 Mar 2023 15:54:03 +0200	[thread overview]
Message-ID: <83wn3r4adg.fsf@gnu.org> (raw)
In-Reply-To: <87wn3rk7bk.fsf@metapensiero.it> (message from Lele Gaifax on Wed, 08 Mar 2023 08:53:19 +0100)

> Cc: Rob Moss <robm.dev@gmail.com>, Dmitry Gutov <dgutov@yandex.ru>
> From: Lele Gaifax <lele@metapensiero.it>
> 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?





  parent reply	other threads:[~2023-03-08 13:54 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wn3r4adg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=62031@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=kobarity@gmail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).