From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Lopez 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: Sun, 17 Sep 2023 05:06:10 +0100 Message-ID: References: <3a4467d3-f190-4115-b73a-9ae18b31a527@gmail.com> <83led6igai.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6910"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 65870@debbugs.gnu.org To: kobarity , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 17 06:07:08 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 1qhj3s-0001bU-GL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Sep 2023 06:07:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhj3h-0002o6-4e; Sun, 17 Sep 2023 00:06: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 1qhj3e-0002ng-LF for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 00:06:54 -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 1qhj3e-0002dy-DS for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 00:06:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhj3l-00025F-OT for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 00:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Lopez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Sep 2023 04:07:01 +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.16949236107990 (code B ref 65870); Sun, 17 Sep 2023 04:07:01 +0000 Original-Received: (at 65870) by debbugs.gnu.org; 17 Sep 2023 04:06:50 +0000 Original-Received: from localhost ([127.0.0.1]:48842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhj3Z-00024n-Op for submit@debbugs.gnu.org; Sun, 17 Sep 2023 00:06:50 -0400 Original-Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:51516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhj3W-00024X-Gg for 65870@debbugs.gnu.org; Sun, 17 Sep 2023 00:06:48 -0400 Original-Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-403012f27e3so39091085e9.3 for <65870@debbugs.gnu.org>; Sat, 16 Sep 2023 21:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694923593; x=1695528393; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=f3Mby2YFMJmDKaXkTq3u4fr7WaGh10Oz7qF5BV4kmaw=; b=aq3pmePTLV59KVelY27SVEMSnuLHe8rhYAjD1+GjHpAzkLvVIRUfceY+/4tUNjL5wP OArtlDT/PJ39JoBLB77CrZ1xA68rBOeeeXdJZAQeLdv4TZoVbbJPeNm+6+E4Wy99tWH4 KI99J8km9WLvEy55cPTXZ/6+XJYxAym0RCChUPHwM221/e8whOkkQhDyxL5RVzp0Rs86 Op79BI66TZx3z9dr5G4nvZPCQWRiP2FJie5PCNUlUwsXqzskETMY6QQRUfHrGGBqaSIz vbC2o+ZXlZ2LM2CrNPckNDLAsHTjI2+j88v3l1GNm2QcdUQFELmGUA1+DaWxeow+Mn6N bWQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694923593; x=1695528393; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f3Mby2YFMJmDKaXkTq3u4fr7WaGh10Oz7qF5BV4kmaw=; b=uz0d/3PCmJW3fp5oDRwCKSJXOYdy4SNNaUCWK8KnDACrt7UBs3O3r+8EUFwoOXxsDd fYTJzwk6N17u+X8kmf2k05Jg8Yc7mG0m0gDIdz49c1TRTDCPbzphP8FzdWa7FZk06c4p 56nIm5NoqQXA6+cdn6y5ykdvdsI9aWeiwMtxZzE43IfGid6LfzLFBa7tM3rpjGCHHrrP I3o0yNuR1j+AVu5DLZMWTwXsW5kKOUTXNITzEeI2mE4OrVKyavEYZ+UID19zLwamWaQC zw5WsqkaJ/56xffzmxFOqkHM5p21rr9m1LEhrns1UetvDMkWFowWtgl3SYA2XC2GptmS crjw== X-Gm-Message-State: AOJu0YxvofzK3SlM4Jg1Q+gImbsiiZgd4e3icIlJqsO7ipoLqNQaUIgx DDZGcyzLxHr4kfikLQV0EVU= X-Google-Smtp-Source: AGHT+IGxofgfeY/lE7NXLnT+hyOCyW6DbnJd0uNuude44v8ZLKu5aiM1joaWQfT8wC5KH+1hIRSmSw== X-Received: by 2002:a1c:4b0f:0:b0:401:4542:5edd with SMTP id y15-20020a1c4b0f000000b0040145425eddmr4906612wma.34.1694923592940; Sat, 16 Sep 2023 21:06:32 -0700 (PDT) Original-Received: from [192.168.2.2] (w-113.cust-u7457.ip.static.uno.uk.net. [212.105.168.113]) by smtp.googlemail.com with ESMTPSA id c3-20020a05600c0ac300b003fef6881350sm8778297wmr.25.2023.09.16.21.06.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Sep 2023 21:06:32 -0700 (PDT) Content-Language: en-US-large In-Reply-To: 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:270660 Archived-At: On 16/09/2023 16:06, kobarity wrote: > > 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. On applying the fix to my own installation, I can confirm that it works for me. Thanks. :)