GNU bug report logs - #59009
python mode indentation behavior fix

Previous Next

Package: emacs;

Reported by: Randomneo <rostislav9999 <at> gmail.com>

Date: Fri, 4 Nov 2022 04:58:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 59009 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Randomneo <rostislav9999 <at> gmail.com>, kobarity <kobarity <at> gmail.com>
Cc: 59009 <at> debbugs.gnu.org
Subject: Re: bug#59009: python mode indentation behavior fix
Date: Sun, 06 Nov 2022 10:18:35 +0200
> From: Randomneo <rostislav9999 <at> gmail.com>
> 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 <rostislav9999 <at> 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

kobarity, any comments on this patch?




This bug report was last modified 2 years and 272 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.