diff options
| author | Dmitry Gutov | 2023-03-08 22:41:23 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2023-03-08 22:48:33 +0200 |
| commit | 34c14430e9d070ffc98527fc95677dd5c5758536 (patch) | |
| tree | 3c85789c30e85ffdb324c46378d5c3151f270c95 /lisp/progmodes/python.el | |
| parent | 8a2a554192a936257e88f12b4dfbd4f923d135f3 (diff) | |
| download | emacs-34c14430e9d070ffc98527fc95677dd5c5758536.tar.gz emacs-34c14430e9d070ffc98527fc95677dd5c5758536.zip | |
Don't misindent 'else:' after 'if re.match:' in Python
* lisp/progmodes/python.el
(python-info-dedenter-opening-block-positions): Check that the
supposed block start is not a method call (bug#62031).
* test/lisp/progmodes/python-tests.el (python-indent-after-re-match):
New test.
Co-authored-by: Lele Gaifax <lele@metapensiero.it>
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ likely an invalid python file." | |||
| 5792 | (catch 'exit | 5792 | (catch 'exit |
| 5793 | (while (python-nav--syntactically | 5793 | (while (python-nav--syntactically |
| 5794 | (lambda () | 5794 | (lambda () |
| 5795 | (re-search-backward (python-rx block-start) nil t)) | 5795 | (cl-loop for pt = (re-search-backward (python-rx block-start) nil t) |
| 5796 | until (memq (char-before) '(nil ?\s ?\t ?\n)) | ||
| 5797 | finally return pt)) | ||
| 5796 | #'<) | 5798 | #'<) |
| 5797 | (let ((indentation (current-indentation))) | 5799 | (let ((indentation (current-indentation))) |
| 5798 | (when (and (not (memq indentation collected-indentations)) | 5800 | (when (and (not (memq indentation collected-indentations)) |