From 29228e24f20954b93dccef4ac5d704ca31daa80c Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 9 Mar 2023 17:24:54 +0200 Subject: python-info-dedenter-opening-block-positions: Fix to support "bare" match * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Make the check stricter. Require that block starts only at indentation. * test/lisp/progmodes/python-tests.el (python-indent-after-bare-match): Another test (bug#62031). --- lisp/progmodes/python.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/progmodes/python.el') diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5b11d204de1..1980815bae9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5792,7 +5792,9 @@ likely an invalid python file." (while (python-nav--syntactically (lambda () (cl-loop while (re-search-backward (python-rx block-start) nil t) - if (memq (char-before) '(nil ?\s ?\t ?\n)) + if (save-match-data + (looking-back (rx line-start (* whitespace)) + (line-beginning-position))) return t)) #'<) (let ((indentation (current-indentation))) -- cgit v1.2.1