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, 08 Jun 2024 15:29:19 +0300 Message-ID: <86jzizd3ds.fsf@gnu.org> References: <3a4467d3-f190-4115-b73a-9ae18b31a527@gmail.com> <83led6igai.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1735"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65870-done@debbugs.gnu.org, daniel.lopez999@gmail.com To: kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 08 14:30:26 2024 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 1sFvDG-0000En-2B for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Jun 2024 14:30:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFvCn-0007U3-Pc; Sat, 08 Jun 2024 08:29:57 -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 1sFvCd-0007Sh-L9 for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 08:29:48 -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 1sFvCc-0005yd-PT for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 08:29:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFvCs-0003T8-Gt for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 08:30:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Jun 2024 12:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 65870 X-GNU-PR-Package: emacs Mail-Followup-To: 65870@debbugs.gnu.org, eliz@gnu.org, daniel.lopez999@gmail.com Original-Received: via spool by 65870-done@debbugs.gnu.org id=D65870.171784979113286 (code D ref 65870); Sat, 08 Jun 2024 12:30:02 +0000 Original-Received: (at 65870-done) by debbugs.gnu.org; 8 Jun 2024 12:29:51 +0000 Original-Received: from localhost ([127.0.0.1]:37724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFvCg-0003S9-UW for submit@debbugs.gnu.org; Sat, 08 Jun 2024 08:29:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFvCe-0003Ru-2w for 65870-done@debbugs.gnu.org; Sat, 08 Jun 2024 08:29:49 -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 1sFvCJ-0005y1-0T; Sat, 08 Jun 2024 08:29:27 -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=dZYgBdVUejGA0NMQ22SsOMHqy5xTYXE8E5HzUHKwAb0=; b=pNrFr2aSlQLU 2wYSVRkuRD+nWNx+cBGFFRZwMFg1IrOKcvaJqMmIlLzl4moAqlagP5W4MCyyd5QHfNlKBTbIOaCZG QUA4eo47SCIlOg7iamgQskbmYjZSEyANCgxueCYTktP97xgQSOHMm+TBmYQtkjJpJ8piHudjLsAdq WaKre7c9O7gW3Lw76ZNR3VlnDl0zTCg3THWsfRWU+V0n67qsQGIzLCt2sK8UI7hBdPsygaxZuwc7F O80mj+z9Lb/NRbX2FjjCtcGPv8J3Pp3WZK0S38CrotGbFYuJBuoEOq4ZXnkTkH0jH80SEzdxhlL2o pwl4s+9zkk1pkLsg3LySgQ==; In-Reply-To: (message from kobarity on Sun, 17 Sep 2023 00:06:58 +0900) 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:286844 Archived-At: > Date: Sun, 17 Sep 2023 00:06:58 +0900 > From: kobarity > Cc: Daniel Lopez , > 65870@debbugs.gnu.org > > Eli Zaretskii wrote: > > > 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? > > Thank you for the report. The attached is the proposed fix. Thanks, installed on the master branch, and closing the bug.