GNU bug report logs -
#75729
[PATCH] python-mode: add `exit` to the list of block-enders
Previous Next
To reply to this bug, email your comments to 75729 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 15:43:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 21 Jan 2025 15:43:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
`exit()` ends current codeflow, there can't be any code past it. So
account `exit` similarly to `return`, `continue`, etc.
[1.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 15:49:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 75729 <at> debbugs.gnu.org (full text, mbox):
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Date: Tue, 21 Jan 2025 18:41:54 +0300
>
>
> `exit()` ends current codeflow, there can't be any code past it. So
> account `exit` similarly to `return`, `continue`, etc.
>
> From 7806987dd88b2507d97255c2e6ca989e791c798b Mon Sep 17 00:00:00 2001
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Date: Tue, 21 Jan 2025 18:34:54 +0300
> Subject: [PATCH] python-mode: add `exit` to the list of block-enders
>
> `exit()` ends current codeflow, there can't be any code past it. So
> account `exit` similarly to `return`, `continue`, etc.
>
> * /lisp/progmodes/python.el (python-rx): add `exit` to the list of
> block-enders.
This should start with a capital letter (to be a complete sentence).
> ---
> lisp/progmodes/python.el | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index 16c296a8f86..2feb9f47e1a 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -442,7 +442,8 @@ python-rx
> symbol-end))
> (block-ender (seq symbol-start
> (or
> - "break" "continue" "pass" "raise" "return")
> + "break" "continue" "pass" "raise" "return"
> + "exit")
> symbol-end))
> (decorator (seq line-start (* space) ?@ (any letter ?_)
> (* (any word ?_))))
> --
> 2.48.1
>
Thanks. kobarity, any comments?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 15:50:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 75729 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Do you want to consider more of the terminal calls? os.exit() os._exit()
sys.exit() quit() (though quit raises SystemExit which could be locally
caught; I think it's equivalent to raise SystemExit?).
On Tue, Jan 21, 2025 at 10:43 AM Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
wrote:
> `exit()` ends current codeflow, there can't be any code past it. So
> account `exit` similarly to `return`, `continue`, etc.
>
>
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 15:56:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 75729 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Tue, 2025-01-21 at 10:47 -0500, Ship Mints wrote:
> Do you want to consider more of the terminal calls? os.exit()
> os._exit() sys.exit() quit() (though quit raises SystemExit which
> could be locally caught; I think it's equivalent to raise
> SystemExit?).
>
> On Tue, Jan 21, 2025 at 10:43 AM Konstantin Kharlamov
> <Hi-Angel <at> yandex.ru> wrote:
> > `exit()` ends current codeflow, there can't be any code past it. So
> > account `exit` similarly to `return`, `continue`, etc.
Good point, thank you! I changed the patch to account for `quit` as
well.
If this is acceptable, I'd prefer to be light on the changes here and
only account for exit and quit for now because it's very simple to
support 😊
Also fixed the commit message per Eli's comment.
[1.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 15:57:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 75729 <at> debbugs.gnu.org (full text, mbox):
On Tue, 2025-01-21 at 17:48 +0200, Eli Zaretskii wrote:
> > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > Date: Tue, 21 Jan 2025 18:41:54 +0300
> >
> >
> > `exit()` ends current codeflow, there can't be any code past it. So
> > account `exit` similarly to `return`, `continue`, etc.
> >
> > From 7806987dd88b2507d97255c2e6ca989e791c798b Mon Sep 17 00:00:00
> > 2001
> > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > Date: Tue, 21 Jan 2025 18:34:54 +0300
> > Subject: [PATCH] python-mode: add `exit` to the list of block-
> > enders
> >
> > `exit()` ends current codeflow, there can't be any code past it. So
> > account `exit` similarly to `return`, `continue`, etc.
> >
> > * /lisp/progmodes/python.el (python-rx): add `exit` to the list of
> > block-enders.
>
> This should start with a capital letter (to be a complete sentence).
Thank you! Fixed in the v2 sent in reply to Ship's email 😊
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 18:54:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 75729 <at> debbugs.gnu.org (full text, mbox):
Konstantin Kharlamov <Hi-Angel <at> yandex.ru> writes:
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index 16c296a8f86..2feb9f47e1a 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -442,7 +442,8 @@ python-rx
> symbol-end))
> (block-ender (seq symbol-start
> (or
> - "break" "continue" "pass" "raise" "return")
> + "break" "continue" "pass" "raise" "return"
> + "exit")
> symbol-end))
> (decorator (seq line-start (* space) ?@ (any letter ?_)
> (* (any word ?_))))
> --
> 2.48.1
Could you describe what behaviour changes this will result in?
I recommend something brief about that to the commit message too.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 19:01:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 75729 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Tue, 2025-01-21 at 10:52 -0800, Stefan Kangas wrote:
> Konstantin Kharlamov <Hi-Angel <at> yandex.ru> writes:
>
> > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> > index 16c296a8f86..2feb9f47e1a 100644
> > --- a/lisp/progmodes/python.el
> > +++ b/lisp/progmodes/python.el
> > @@ -442,7 +442,8 @@ python-rx
> > symbol-end))
> > (block-ender (seq symbol-start
> > (or
> > - "break" "continue" "pass"
> > "raise" "return")
> > + "break" "continue" "pass"
> > "raise" "return"
> > + "exit")
> > symbol-end))
> > (decorator (seq line-start (* space) ?@ (any
> > letter ?_)
> > (* (any word ?_))))
> > --
> > 2.48.1
>
> Could you describe what behaviour changes this will result in?
>
> I recommend something brief about that to the commit message too.
Thank you, done! I put the following text to the commit message, please
see if it describes the change well enough:
> `exit()` and `quit()` end the current codeflow, there can't be any
> code past it, similarly to `return`, `continue`, etc. So when
> calculating indentation for the line next to `exit()` and `quit()`,
> decrease the indentation level.
Patch is attached.
[1.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75729
; Package
emacs
.
(Tue, 21 Jan 2025 19:43:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 75729 <at> debbugs.gnu.org (full text, mbox):
Konstantin Kharlamov <Hi-Angel <at> yandex.ru> writes:
> On Tue, 2025-01-21 at 10:52 -0800, Stefan Kangas wrote:
>
>> Could you describe what behaviour changes this will result in?
>>
>> I recommend something brief about that to the commit message too.
>
> Thank you, done! I put the following text to the commit message, please
> see if it describes the change well enough:
Thanks!
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.