Subject: bug#59009: closed (Re: bug#59009: python mode indentation behavior fix)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 10 Nov 2022 10:27:02 +0000

Your bug report

#59009: python mode indentation behavior fix

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59009: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59009
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59009: python mode indentation behavior fix
From: Eli Zaretskii <[email-masked]>
To: kobarity <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 10 Nov 2022 12:26:48 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Mon, 07 Nov 2022 22:57:48 +0900
> From: kobarity <[email-masked]>
> Cc: Randomneo <[email-masked]>,
> 	[email-masked]
> 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.

Subject: python mode indentation behavior fix
From: Randomneo <[email-masked]>
To: [email-masked]
Date: Thu, 3 Nov 2022 18:41:42 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

This patch will fix this bug #42513
<https://debbugs.gnu.org/cgi/bugreport.cgi?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 <[email-masked]>
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