[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65870: 30.0.50; Error in python-mode when try to delete a character
From: |
kobarity |
Subject: |
bug#65870: 30.0.50; Error in python-mode when try to delete a character in badly-indented code |
Date: |
Sun, 17 Sep 2023 00:06:58 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Eli Zaretskii wrote:
> > Date: Mon, 11 Sep 2023 17:36:59 +0100
> > From: Daniel Lopez <daniel.lopez999@gmail.com>
> >
> > To reproduce from emacs -Q:
> > C-x b hello.py RET
> > M-x python-mode
> > On the first line, type the word "return", then press the Return key.
> > On the second line, type one or more spaces.
> > Press Backspace. This triggers the error message:
> > python-indent-line: Wrong type argument: wholenump, -4
> > and, the last-typed space is not deleted.
> >
> > Backtrace of the error:
> > Debugger entered--Lisp error: (wrong-type-argument wholenump -4)
> > indent-line-to(-4)
> > python-indent-line(t)
> > python-indent-dedent-line()
> > python-indent-dedent-line-backspace(1)
> > funcall-interactively(python-indent-dedent-line-backspace 1)
> > command-execute(python-indent-dedent-line-backspace)
> >
> > This can also happen with Python keywords/statements that tend to end a
> > scope, eg. "break" or "raise", as well as "return".
> >
> > I guess the smart dedenting sees the "return" (or similar statement) at
> > top-level scope and then tries to move the cursor to a parent scope /
> > negative column that doesn't exist. Perhaps one of those indent
> > functions could clamp itself somehow to not do that but I'm not sure
> > where the best place for that would be.
>
> Thanks.
>
> kobarity, any suggestions or comments?
Thank you for the report. The attached is the proposed fix.
0001-Fix-Python-mode-error-caused-by-incorrect-indentatio.patch
Description: Binary data