unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Lopez <daniel.lopez999@gmail.com>, kobarity <kobarity@gmail.com>
Cc: 65870@debbugs.gnu.org
Subject: bug#65870: 30.0.50; Error in python-mode when try to delete a character in badly-indented code
Date: Sat, 16 Sep 2023 13:05:57 +0300	[thread overview]
Message-ID: <83led6igai.fsf@gnu.org> (raw)
In-Reply-To: <3a4467d3-f190-4115-b73a-9ae18b31a527@gmail.com> (message from Daniel Lopez on Mon, 11 Sep 2023 17:36:59 +0100)

> 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?





  reply	other threads:[~2023-09-16 10:05 UTC|newest]

Thread overview: 8+ 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 [this message]
2023-09-16 15:06   ` kobarity
2023-09-17  4:06     ` Daniel Lopez
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

  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=83led6igai.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=65870@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 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).