From: Eli Zaretskii <eliz@gnu.org>
To: kobarity <kobarity@gmail.com>
Cc: 65870-done@debbugs.gnu.org, daniel.lopez999@gmail.com
Subject: bug#65870: 30.0.50; Error in python-mode when try to delete a character in badly-indented code
Date: Sat, 08 Jun 2024 15:29:19 +0300 [thread overview]
Message-ID: <86jzizd3ds.fsf@gnu.org> (raw)
In-Reply-To: <eke7msxmxilp.wl-kobarity@gmail.com> (message from kobarity on Sun, 17 Sep 2023 00:06:58 +0900)
> Date: Sun, 17 Sep 2023 00:06:58 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: Daniel Lopez <daniel.lopez999@gmail.com>,
> 65870@debbugs.gnu.org
>
> 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.
Thanks, installed on the master branch, and closing the bug.
next prev parent reply other threads:[~2024-06-08 12:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 16:36 bug#65870: 30.0.50; Error in python-mode when try to delete a character in badly-indented code Daniel Lopez
2023-09-16 10:05 ` Eli Zaretskii
2023-09-16 15:06 ` kobarity
2023-09-17 4:06 ` Daniel Lopez
2024-06-08 12:29 ` Eli Zaretskii [this message]
2024-06-02 21:08 ` Jakub Ječmínek via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-03 11:25 ` Eli Zaretskii
2024-06-04 5:12 ` Andreas Röhler
2024-06-04 5:45 ` Andreas Röhler
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=86jzizd3ds.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=65870-done@debbugs.gnu.org \
--cc=daniel.lopez999@gmail.com \
--cc=kobarity@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.