all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Randomneo <rostislav9999@gmail.com>
To: 59009@debbugs.gnu.org
Subject: bug#59009: python mode indentation behavior fix
Date: Thu, 3 Nov 2022 18:41:42 +0300	[thread overview]
Message-ID: <CALY_2d+6ENn-WEQvT_KsxmsEmgSLs-RMB77FmTbGq-+ELnQudg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 267 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 356 bytes --]

[-- Attachment #2: 0001-python.el-Opening-block-search-fix.patch --]
[-- Type: text/x-patch, Size: 1916 bytes --]

From 91b310d1412366340b6deeff65519e248d87a10f Mon Sep 17 00:00:00 2001
From: Rostyslav Misiura <rostislav9999@gmail.com>
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


             reply	other threads:[~2022-11-03 15:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 15:41 Randomneo [this message]
2022-11-06  8:18 ` bug#59009: python mode indentation behavior fix Eli Zaretskii
2022-11-07 13:57   ` kobarity
2022-11-10 10:26     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALY_2d+6ENn-WEQvT_KsxmsEmgSLs-RMB77FmTbGq-+ELnQudg@mail.gmail.com \
    --to=rostislav9999@gmail.com \
    --cc=59009@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.