From unknown Sat Sep 06 00:11:16 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#59009 <59009@debbugs.gnu.org> To: bug#59009 <59009@debbugs.gnu.org> Subject: Status: python mode indentation behavior fix Reply-To: bug#59009 <59009@debbugs.gnu.org> Date: Sat, 06 Sep 2025 07:11:16 +0000 retitle 59009 python mode indentation behavior fix reassign 59009 emacs submitter 59009 Randomneo severity 59009 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 04 00:57:28 2022 Received: (at submit) by debbugs.gnu.org; 4 Nov 2022 04:57:28 +0000 Received: from localhost ([127.0.0.1]:51397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqolj-00052x-Dq for submit@debbugs.gnu.org; Fri, 04 Nov 2022 00:57:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:43948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqcLt-0003mm-I6 for submit@debbugs.gnu.org; Thu, 03 Nov 2022 11:41:59 -0400 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 1oqcLt-00039B-CS for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 11:41:57 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqcLq-0002ry-IQ for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 11:41:57 -0400 Received: by mail-pl1-x62a.google.com with SMTP id y4so2310720plb.2 for ; Thu, 03 Nov 2022 08:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=e8C7ni8EAdwj49Mflx7bSekqbRj7F/aaBAATgc5NoXU=; b=GjeNL2qLtGfpthceOHcfgBmBiPQt84sXXLlQKjBtohG5Jj3YFoWP5mzzaN4/lPfyaV pJGA/nwJAsJsoHC0AlYIiOS3Ie9CMzozRUWfsAECZqfBtL9p9NqO8dMnRMCvV3sU/ycB LB8xBxMTRTqKFOE7SR93WsHZafEi69WRVwjOnIptVxomTsHXEYvXSQ6Sn859pIbb+T+a DClCGBdNxegmQ5AHE/t2wBmtubipq47MnqnBywT+Nj8c+oH6MGWsrfdgV9ha+05UbNYo pTdP5nb0y19AQgYjZjO6yKIvr8Vvtui0akcpCoMfNsYCqu2y3YrbuPYdCAY7cGIu/Zgv fRmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e8C7ni8EAdwj49Mflx7bSekqbRj7F/aaBAATgc5NoXU=; b=x/prY7WXN2MGJPb0V3Y/HoJmR6MvMDQnogLojzvXU+UyxrCyksOU+LgVZ5P+cnLa5U hIeuW6IXQbLwgTSwx8+8xLxJYkM5lGTDTJV/gssURzZ8oNIkCQG8/VSGlRGfThdYDihg VwDR8BqlOrt/xyKTNtp7CWD1S953ynk+WBw9dPPNvqKm+ue6l0kPh+shAXHaMA3NiEUo lHt7i4b/+GM7wt7qAi3TuReG6HdldxNqKIk0kzPPbQFyqf13/oRiJSsweBviymkTk/n+ VsspiW+BPwK/RvMnnIyPwo++wyIP4FTLLfIEki1+8j08G6xAkL10XmSs2N14DKorC7Ba pkqQ== X-Gm-Message-State: ACrzQf1F3A1s8aTPaRculDRNchc+GHQzNN9pTq+lVisXYGoFqL4nlXrp 8ttl0Fx5lxxCjFHBCpEuy0tyz7cGDjCbOoflfCq2yg+spxkpcWiT X-Google-Smtp-Source: AMsMyM5IGVk7M6rCwZVwPG6FrNuH+ihpOXYCd0Q2Czlj22+Aue368PdS3dP9VE3gcCIwiLzVbv1lOau+HMOMud73GMM= X-Received: by 2002:a17:90b:2248:b0:210:10dc:a314 with SMTP id hk8-20020a17090b224800b0021010dca314mr47830072pjb.15.1667490111406; Thu, 03 Nov 2022 08:41:51 -0700 (PDT) MIME-Version: 1.0 From: Randomneo Date: Thu, 3 Nov 2022 18:41:42 +0300 Message-ID: Subject: python mode indentation behavior fix To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="000000000000c1e08805ec92cb82" Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=rostislav9999@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 04 Nov 2022 00:57:26 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) --000000000000c1e08805ec92cb82 Content-Type: multipart/alternative; boundary="000000000000c1e08705ec92cb80" --000000000000c1e08705ec92cb80 Content-Type: text/plain; charset="UTF-8" This patch will fix this bug #42513 . Also problems with same behaviour with pair of statements when one of them is multiline with prantaces like https://pastebin.com/Z1yFbMtp. with best regards Misiura Rostislav --000000000000c1e08705ec92cb80 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This patch will fix this bug=C2=A0#42513.
Also problems with= same behaviour with pair of statements when one of them is multiline with = prantaces like https://pastebin.c= om/Z1yFbMtp.

with best=C2=A0regards Misiura Rostislav
--000000000000c1e08705ec92cb80-- --000000000000c1e08805ec92cb82 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-python.el-Opening-block-search-fix.patch" Content-Disposition: attachment; filename="0001-python.el-Opening-block-search-fix.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_la18jrvk0 RnJvbSA5MWIzMTBkMTQxMjM2NjM0MGI2ZGVlZmY2NTUxOWUyNDhkODdhMTBmIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBSb3N0eXNsYXYgTWlzaXVyYSA8cm9zdGlzbGF2OTk5OUBnbWFp bC5jb20+CkRhdGU6IFRodSwgMyBOb3YgMjAyMiAxODoyNzozOCArMDMwMApTdWJqZWN0OiBbUEFU Q0hdIHB5dGhvbi5lbDogT3BlbmluZyBibG9jayBzZWFyY2ggZml4CgotLS0KIGxpc3AvcHJvZ21v ZGVzL3B5dGhvbi5lbCB8IDggKysrKy0tLS0KIDEgZmlsZSBjaGFuZ2VkLCA0IGluc2VydGlvbnMo KyksIDQgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvbGlzcC9wcm9nbW9kZXMvcHl0aG9uLmVs IGIvbGlzcC9wcm9nbW9kZXMvcHl0aG9uLmVsCmluZGV4IGNlYzBkNTRhNDQuLjNjYThlNDlmMmIg MTAwNjQ0Ci0tLSBhL2xpc3AvcHJvZ21vZGVzL3B5dGhvbi5lbAorKysgYi9saXNwL3Byb2dtb2Rl cy9weXRob24uZWwKQEAgLTUzNzMsMTYgKzUzNzMsMTYgQEAgbGlrZWx5IGFuIGludmFsaWQgcHl0 aG9uIGZpbGUuIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhcHBseSAjJ21p biBjb2xsZWN0ZWQtaW5kZW50YXRpb25zKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA7 OyBUaGVyZSBtdXN0IGJlIG5vIGxpbmUgd2l0aCBpbmRlbnRhdGlvbgogICAgICAgICAgICAgICAg ICAgICAgICAgICAgOzsgc21hbGxlciB0aGFuIGBpbmRlbnRhdGlvbicgKGV4Y2VwdCBmb3IKLSAg ICAgICAgICAgICAgICAgICAgICAgICAgIDs7IGJsYW5rIGxpbmVzKSBiZXR3ZWVuIHRoZSBmb3Vu ZCBvcGVuaW5nCi0gICAgICAgICAgICAgICAgICAgICAgICAgICA7OyBibG9jayBhbmQgdGhlIGN1 cnJlbnQgbGluZSwgb3RoZXJ3aXNlIGl0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICA7OyBp cyBub3QgYW4gb3BlbmluZyBibG9jay4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDs7IGJs YW5rIGxpbmVzIGFuZCBjb21tZW50cykgYmV0d2VlbiB0aGUgZm91bmQKKyAgICAgICAgICAgICAg ICAgICAgICAgICAgIDs7IG9wZW5pbmcgYmxvY2sgYW5kIHRoZSBjdXJyZW50IGxpbmUsCisgICAg ICAgICAgICAgICAgICAgICAgICAgICA7OyBvdGhlcndpc2UgaXQgaXMgbm90IGFuIG9wZW5pbmcg YmxvY2suCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoc2F2ZS1leGN1cnNpb24KICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKGZvcndhcmQtbGluZSkKICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKGxldCAoKG5vLWJhY2staW5kZW50IHQpKQogICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIChzYXZlLW1hdGNoLWRhdGEKICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICh3aGlsZSAoYW5kICg8IChwb2ludCkgY3VyLWxpbmUpCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoc2V0cSBuby1iYWNrLWluZGVudAotICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG9yICg+IChjdXJy ZW50LWluZGVudGF0aW9uKSBpbmRlbnRhdGlvbikKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIChvciAoPj0gKGN1cnJlbnQtaW5kZW50YXRpb24pIGlu ZGVudGF0aW9uKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIChweXRob24taW5mby1jdXJyZW50LWxpbmUtZW1wdHktcCkKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHl0aG9uLWluZm8t Y3VycmVudC1saW5lLWNvbW1lbnQtcCkpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGZvcndhcmQtbGluZSkpKQotLSAKMi4zOC4xCgo= --000000000000c1e08805ec92cb82-- From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 06 03:19:02 2022 Received: (at 59009) by debbugs.gnu.org; 6 Nov 2022 08:19:03 +0000 Received: from localhost ([127.0.0.1]:58621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oraru-0002Gs-Je for submit@debbugs.gnu.org; Sun, 06 Nov 2022 03:19:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1orars-0002GM-FJ for 59009@debbugs.gnu.org; Sun, 06 Nov 2022 03:19:01 -0500 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 1orarm-0006Rs-Kw; Sun, 06 Nov 2022 03:18:55 -0500 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=iRaHIEPORtPh2f26SjaPhEh2LjNMgazQfNJYNCZu2IY=; b=opXaI5DtOkGM dnhJvh4KNmtkYwSbJccyBLJEmZOHopznRgmYenm/jlXd6fGiQ5yU7IILraX8cNnshUfNFCpJZ7Zfe RwhUpQ7cNfDE8foDXcdGPw0HloSqmV/8NnCN4CO9XtVowRcRVpxRETl0NXYUJffaaTg0PlLa5HSqJ 4wXNrHNky37QdBOghUrIkuoBx9iNMb0WKvD3TUU/FngL9mTVqz8mWzf3AYUf4Y0XXFOYbC/O2j/5s J9b343FcxDpQuBppLhECIVxnLx6HAst1KuWE5luo0kzR9DVlxa1gER7uwG+HGl/4SUxwgL0W88iTQ 6BS+DPFWsdKkiEiBxSw8Pw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orarl-0002KX-Ng; Sun, 06 Nov 2022 03:18:54 -0500 Date: Sun, 06 Nov 2022 10:18:35 +0200 Message-Id: <83wn881oo4.fsf@gnu.org> From: Eli Zaretskii To: Randomneo , kobarity In-Reply-To: (message from Randomneo on Thu, 3 Nov 2022 18:41:42 +0300) Subject: Re: bug#59009: python mode indentation behavior fix References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59009 Cc: 59009@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Randomneo > Date: Thu, 3 Nov 2022 18:41:42 +0300 > > This patch will fix this bug #42513. > Also problems with same behaviour with pair of statements when one of them is multiline with prantaces like > https://pastebin.com/Z1yFbMtp. > > with best regards Misiura Rostislav > > From 91b310d1412366340b6deeff65519e248d87a10f Mon Sep 17 00:00:00 2001 > From: Rostyslav Misiura > Date: Thu, 3 Nov 2022 18:27:38 +0300 > Subject: [PATCH] python.el: Opening block search fix > > --- > lisp/progmodes/python.el | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el > index cec0d54a44..3ca8e49f2b 100644 > --- a/lisp/progmodes/python.el > +++ b/lisp/progmodes/python.el > @@ -5373,16 +5373,16 @@ likely an invalid python file." > (apply #'min collected-indentations))) > ;; There must be no line with indentation > ;; smaller than `indentation' (except for > - ;; blank lines) between the found opening > - ;; block and the current line, otherwise it > - ;; is not an opening block. > + ;; blank lines and comments) between the found > + ;; opening block and the current line, > + ;; otherwise it is not an opening block. > (save-excursion > (forward-line) > (let ((no-back-indent t)) > (save-match-data > (while (and (< (point) cur-line) > (setq no-back-indent > - (or (> (current-indentation) indentation) > + (or (>= (current-indentation) indentation) > (python-info-current-line-empty-p) > (python-info-current-line-comment-p)))) > (forward-line))) > -- > 2.38.1 kobarity, any comments on this patch? From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 07 08:58:24 2022 Received: (at 59009) by debbugs.gnu.org; 7 Nov 2022 13:58:24 +0000 Received: from localhost ([127.0.0.1]:33641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1os2ds-0002zh-It for submit@debbugs.gnu.org; Mon, 07 Nov 2022 08:58:24 -0500 Received: from mail-pl1-f170.google.com ([209.85.214.170]:41582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1os2dq-0002zU-Vb for 59009@debbugs.gnu.org; Mon, 07 Nov 2022 08:58:23 -0500 Received: by mail-pl1-f170.google.com with SMTP id io19so11120666plb.8 for <59009@debbugs.gnu.org>; Mon, 07 Nov 2022 05:58:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=H2m4FWJygRhS9Tfdt3Omujp4YskzqQE5iuDamcDS7rE=; b=ZXHlxqYYS0Yq20H1534QJZB5wkbxf+WqXW82x6unN232gfjQTYbWx6ASI0G5VpZUD1 qf/Qtwfpfp8aJd00zfoyyd2Sjj/MTuYXoYp/iLyZjeQeHYSJJmv/r9rR804ZTTSdTDwc hNRQqTyo8u3woV1zPNTuolazcARxkfi0J08JXUD73fv+ojARI5UVYOuqgcTINQtewfsR KRzHuuuE1pgKKHEfJ89gMMilWjkVdEZbL1pBEom/Zs4do2RjGsPRAdiNl+Y+Uq39dQBc JOtvfj1fcgz0AM5nuC6RmYoy8AlFvQbGlCBE5Z1LRKhBB9n0KGUYYRJzMIwgyMlX19S4 9r3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H2m4FWJygRhS9Tfdt3Omujp4YskzqQE5iuDamcDS7rE=; b=gS3RcmpXFSz+9ouZpC9cYNS9oTHdwwAzBwBP0CMa2nqdZ1asGL4yyvSEz7HSM6oSSh Vai/JD/MCc+H8rtpqWlxU7O2lys0z2Wpm24vPh9f6n8j5yzBD+TvqXouPaCMy+D0FAco MbobYC2CWx7WDRjwAVJ/Qsmve5mIAds3pOVTaf5nKomyf9Rd4ZztKdln7mcfEgtloIYI Vs7eQCoPLoqC5TSde1O00VCwF0TpyDx0ZZ1KwzhA2Lq7SXvGcb8sPAZ3YqEP9pFpsetS +eKMQhrNiwsW8IrvfrvLcf0KUELzuyFOfkpTb6/a8j3Cj46CoWFzdXCSZxz6CUzguHAz pfCA== X-Gm-Message-State: ACrzQf20nONsimdSm97rRkRNnQ2yqPBn0r166hLz64K++LivRFQF02yG Or1SwNDWIfIJsNMUJ3dTIUk= X-Google-Smtp-Source: AMsMyM4j5zZ1ezDN0O8vej5oYWNm7npk5dvY7rWZI2VQsHEFxkv2HDMPgt/vzJp+JTlXPsAkzp6F1w== X-Received: by 2002:a17:902:b70c:b0:179:eb79:cf9a with SMTP id d12-20020a170902b70c00b00179eb79cf9amr50398052pls.130.1667829497054; Mon, 07 Nov 2022 05:58:17 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id k3-20020a170902c40300b00176a6ba5969sm5023340plk.98.2022.11.07.05.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 05:58:16 -0800 (PST) Date: Mon, 07 Nov 2022 22:57:48 +0900 Message-ID: From: kobarity To: Eli Zaretskii Subject: Re: bug#59009: python mode indentation behavior fix In-Reply-To: <83wn881oo4.fsf@gnu.org> References: <83wn881oo4.fsf@gnu.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Mon_Nov__7_22:57:47_2022-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59009 Cc: 59009@debbugs.gnu.org, Randomneo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Multipart_Mon_Nov__7_22:57:47_2022-1 Content-Type: text/plain; charset=US-ASCII Eli Zaretskii wrote: > > From: Randomneo > > > > This patch will fix this bug #42513. > > kobarity, any comments on this patch? Hello, Unfortunately, the presented patch breaks the ERT python-indent-electric-colon-4. I think the problem lies in the forward-line after block-start detection. The while loop is used to detect indentation inside the block, so if block-start spans multiple lines, it should start at the next line. To address this issue, I propose to add python-nav-end-of-statement before forward-line. Attached is the patch with an ERT. Regards, --Multipart_Mon_Nov__7_22:57:47_2022-1 Content-Type: application/octet-stream; type=patch; name="0001-Fix-indentation-for-multi-line-block-start-in-Python.patch" Content-Disposition: attachment; filename="0001-Fix-indentation-for-multi-line-block-start-in-Python.patch" Content-Transfer-Encoding: 7bit >From 20c81eb76f8e9251610f40e7cb6c110ddabbb8c6 Mon Sep 17 00:00:00 2001 From: kobarity Date: Mon, 7 Nov 2022 22:24:44 +0900 Subject: [PATCH] Fix indentation for multi-line block start in Python mode * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Fix for multi-line block start. * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-6): New test. (Bug#59009) --- lisp/progmodes/python.el | 1 + test/lisp/progmodes/python-tests.el | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index cec0d54a44..a734e06149 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5377,6 +5377,7 @@ python-info-dedenter-opening-block-positions ;; block and the current line, otherwise it ;; is not an opening block. (save-excursion + (python-nav-end-of-statement) (forward-line) (let ((no-back-indent t)) (save-match-data diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 8330525394..f871b7bc7d 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5592,6 +5592,23 @@ python-info-dedenter-opening-block-positions-5 (equal (list (python-tests-look-at "else:" -1 t)) (python-info-dedenter-opening-block-positions))))) +(ert-deftest python-info-dedenter-opening-block-positions-6 () + "Test multiline block start." + (python-tests-with-temp-buffer + " +def func(): + if ( + cond1 or + cond2 + ): + something() + else +" + (python-tests-look-at "else\n") + (should + (equal (list (python-tests-look-at "if (" -1 t)) + (python-info-dedenter-opening-block-positions))))) + (ert-deftest python-info-dedenter-opening-block-message-1 () "Test dedenters inside strings are ignored." (python-tests-with-temp-buffer -- 2.34.1 --Multipart_Mon_Nov__7_22:57:47_2022-1-- From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 10 05:26:57 2022 Received: (at 59009-done) by debbugs.gnu.org; 10 Nov 2022 10:26:57 +0000 Received: from localhost ([127.0.0.1]:42016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot4lt-0007pr-IM for submit@debbugs.gnu.org; Thu, 10 Nov 2022 05:26:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot4lr-0007pe-SB for 59009-done@debbugs.gnu.org; Thu, 10 Nov 2022 05:26:56 -0500 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 1ot4lm-0005nd-IX; Thu, 10 Nov 2022 05:26:50 -0500 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=x7qWwDUEXPXmzBMCReu5cGdsH42Wau0Bn/Xd4865fRk=; b=ZXnprOstkycZ j6sVzgIfe3XSFYMhmS5z3ouw78oc70rPhtA3lmbRzNtPgFrnZsZ8+w+MmcOPb96NfqvlpSakfDlX6 FBVHPABSVU434S511zONgDAYpaSR8lu09E5tz2/uK48nIOTcRR+nMQeKY4jrrIgSL5huPlxD7fH63 lifvOx2H1pd9qSw/PPGGMrcKeXEX4eSxY5u1g1MI61+KrXJovPkmImafgzqIsjpo2jtfPrtOSN5YP 8UjPVLqhsn1+ezMgVT5DK+MFddLBWd6JzExgWi4d7cU526w+w0vaLKYqLZxAG3JXSe+40AwCK8Ucz Ltec0gagFpJazEku2baUsg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot4lm-0007j3-1p; Thu, 10 Nov 2022 05:26:50 -0500 Date: Thu, 10 Nov 2022 12:26:48 +0200 Message-Id: <837d03rtp3.fsf@gnu.org> From: Eli Zaretskii To: kobarity In-Reply-To: (message from kobarity on Mon, 07 Nov 2022 22:57:48 +0900) Subject: Re: bug#59009: python mode indentation behavior fix References: <83wn881oo4.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59009-done Cc: 59009-done@debbugs.gnu.org, rostislav9999@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 07 Nov 2022 22:57:48 +0900 > From: kobarity > Cc: Randomneo , > 59009@debbugs.gnu.org > Unfortunately, the presented patch breaks the ERT > python-indent-electric-colon-4. > > I think the problem lies in the forward-line after block-start > detection. The while loop is used to detect indentation inside the > block, so if block-start spans multiple lines, it should start at the > next line. To address this issue, I propose to add > python-nav-end-of-statement before forward-line. Attached is the > patch with an ERT. Thanks, installed. From unknown Sat Sep 06 00:11:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 08 Dec 2022 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator