unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: kobarity <kobarity@gmail.com>
Cc: Lele Gaifax <lele@metapensiero.it>, 62092@debbugs.gnu.org
Subject: bug#62092: 30.0.50; "case" does not work as dedenter in Python
Date: Sun, 26 Mar 2023 05:04:12 +0300	[thread overview]
Message-ID: <39f89289-3659-89c0-2d69-b7dd7d5f2391@yandex.ru> (raw)
In-Reply-To: <eke74jq8nclp.wl-kobarity@gmail.com>

On 25/03/2023 16:13, kobarity wrote:
> 
> Dmitry Gutov wrote:
>> Pushed your change to emacs-29, and closing. Thanks!
> 
> Thank you for applying the patch.  However, I overlooked one problem.
> 
> #+begin_src python
> match a:
>      case 1:
>          match b:
>              case 2
> #+end_src
> 
> When I type ":" at the last line after "case 2", the message "Closes
> case 1:" is shown.  This is wrong because it cannot be the "case"
> block of the outer "match" block (match a:).  I'm sorry if you were
> mentioning this case.

Not really, I wasn't thinking about this one in particular.

> Similar message can be shown with "elif":
> 
> #+begin_src python
> for c in (1, 2):
>      if a == 1:
>          for d in (3, 4):
>              elif b == 1:
> #+end_src
> 
> However, this is not a correct Python code because "elif" cannot be
> the first sentence in a block.
> 
> Dedenters other than "case" can never be the first sentence of a
> block, whereas "case" can be the first sentence of a block.
> 
> So I think it is appropriate that the first "case" in the block should
> not be considered a dedenter.  Attached is a patch to add a condition
> in `python-info-dedenter-statement-p'.

Thanks! I've pushed it to emacs-29 as well.





  reply	other threads:[~2023-03-26  2:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  5:33 bug#62092: 30.0.50; "case" does not work as dedenter in Python kobarity
2023-03-10  7:36 ` Eli Zaretskii
2023-03-10  8:27   ` kobarity
2023-03-11  0:27 ` Dmitry Gutov
2023-03-11  2:08   ` kobarity
2023-03-11 13:18     ` Dmitry Gutov
2023-03-25 14:13       ` kobarity
2023-03-26  2:04         ` Dmitry Gutov [this message]
2023-08-14 15:12 ` Mattias Engdegård
2023-08-15 13:43   ` kobarity
2023-08-15 15:09     ` Mattias Engdegård

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=39f89289-3659-89c0-2d69-b7dd7d5f2391@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=62092@debbugs.gnu.org \
    --cc=kobarity@gmail.com \
    --cc=lele@metapensiero.it \
    /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).