GNU bug report logs - #62031
29.0.60; python-mode indentation after re.match

Previous Next

Package: emacs;

Reported by: Rob Moss <robm.dev <at> gmail.com>

Date: Tue, 7 Mar 2023 08:55:01 UTC

Severity: normal

Found in version 29.0.60

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lele Gaifax <lele <at> metapensiero.it>, 62031 <at> debbugs.gnu.org
Cc: Rob Moss <robm.dev <at> gmail.com>
Subject: Re: bug#62031: 29.0.60; python-mode indentation after re.match
Date: Wed, 8 Mar 2023 20:15:03 +0200
On 08/03/2023 19:57, Dmitry Gutov wrote:
> After some edebug-ing, the patch below seems to fix this case

Small correction for cases outside of any blocks:

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 1f970633bfc..81475f31f60 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5792,7 +5792,9 @@ python-info-dedenter-opening-block-positions
           (catch 'exit
             (while (python-nav--syntactically
                     (lambda ()
-                      (re-search-backward (python-rx block-start) nil t))
+                      (cl-loop for pt = (re-search-backward (python-rx 
block-start) nil t)
+                               until (memq (char-before) '(nil ?\s ?\t 
?\n))
+                               finally return pt))
                     #'<)
               (let ((indentation (current-indentation)))
                 (when (and (not (memq indentation collected-indentations))





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

Previous Next


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