From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83led6igai.fsf@gnu.org> References: <3a4467d3-f190-4115-b73a-9ae18b31a527@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14391"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65870@debbugs.gnu.org To: Daniel Lopez , kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 16 12:07:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qhSCp-0003at-AY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Sep 2023 12:07:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhSCY-0000Xd-3T; Sat, 16 Sep 2023 06:06:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhSCV-0000XE-FN for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:06:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhSCV-0005pm-7c for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:06:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhSCc-0003Wf-4L for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Sep 2023 10:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65870 X-GNU-PR-Package: emacs Original-Received: via spool by 65870-submit@debbugs.gnu.org id=B65870.169485878113493 (code B ref 65870); Sat, 16 Sep 2023 10:07:02 +0000 Original-Received: (at 65870) by debbugs.gnu.org; 16 Sep 2023 10:06:21 +0000 Original-Received: from localhost ([127.0.0.1]:45434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhSBw-0003VZ-SV for submit@debbugs.gnu.org; Sat, 16 Sep 2023 06:06:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhSBu-0003VJ-Pl for 65870@debbugs.gnu.org; Sat, 16 Sep 2023 06:06:19 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhSBh-0005bF-Ju; Sat, 16 Sep 2023 06:06:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+Lj8CMFWD39e1F+QQOWONulGU3S11pxoWmllTib2CxI=; b=RO2obgqp/8AG kmT1qZUA3rN5G2zcB3fSHgJN+Rf01YyLv0JefA4Fap1ae4AEaJZC0lro/DN08Ffy56IIIBjBjWoqr jNYt6QEPWwuFyl4HXPZBfsmgmUmd62S3b113IN7iD0jGuZhoRSdrq1FkMpWvwheTs1hTl6NUtbGkf xDbQEGEYbiew/oqh6MIO+5xvWkYu9vUamkR9pLh9bWzpgkCBy0Yvl8wyIl+tguZLHkMUd1pXcYJB/ m41bN3sWf6EgRlnclofGmRpNJq8mPDBNGM+/w22G5dcqzFodlP6jkzgqFYl2WIYt2hpUVF48vDTBf 1UPl79xwEtmTAgxHdrImHA==; In-Reply-To: <3a4467d3-f190-4115-b73a-9ae18b31a527@gmail.com> (message from Daniel Lopez on Mon, 11 Sep 2023 17:36:59 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270600 Archived-At: > Date: Mon, 11 Sep 2023 17:36:59 +0100 > From: Daniel Lopez > > 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?