unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Lopez <daniel.lopez999@gmail.com>
To: kobarity <kobarity@gmail.com>, Eli Zaretskii <eliz@gnu.org>
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: Sun, 17 Sep 2023 05:06:10 +0100	[thread overview]
Message-ID: <da556700-20ce-4d81-a5e3-88de06e9f763@gmail.com> (raw)
In-Reply-To: <eke7msxmxilp.wl-kobarity@gmail.com>

On 16/09/2023 16:06, kobarity wrote:
> 
> 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.

On applying the fix to my own installation, I can confirm that it works 
for me. Thanks. :)





      reply	other threads:[~2023-09-17  4:06 UTC|newest]

Thread overview: 4+ 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 [this message]

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=da556700-20ce-4d81-a5e3-88de06e9f763@gmail.com \
    --to=daniel.lopez999@gmail.com \
    --cc=65870@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --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).