aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorkobarity2023-09-16 23:14:45 +0900
committerEli Zaretskii2024-06-08 15:27:47 +0300
commitc03cafba390603de653def097fdcf9566d502061 (patch)
tree3b844ea9cce930f18f4813032ee0b0f924ee5abf /lisp/progmodes/python.el
parentd7be9fdbc009ecf314e1ae9166429188b6ddb121 (diff)
downloademacs-c03cafba390603de653def097fdcf9566d502061.tar.gz
emacs-c03cafba390603de653def097fdcf9566d502061.zip
Fix Python mode error caused by incorrect indentation
* lisp/progmodes/python.el (python-indent--calculate-indentation): Guard against negative indentation. (Bug #65870) * test/lisp/progmodes/python-tests.el (python-indent-badly-indented-block-end): New test.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b5c00385ef3..bb2bf1731b4 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1819,7 +1819,7 @@ possibilities can be narrowed to specific indentation points."
1819 (`(:after-block-end . ,start) 1819 (`(:after-block-end . ,start)
1820 ;; Subtract one indentation level. 1820 ;; Subtract one indentation level.
1821 (goto-char start) 1821 (goto-char start)
1822 (- (current-indentation) python-indent-offset)) 1822 (max 0 (- (current-indentation) python-indent-offset)))
1823 (`(:at-dedenter-block-start . ,_) 1823 (`(:at-dedenter-block-start . ,_)
1824 ;; List all possible indentation levels from opening blocks. 1824 ;; List all possible indentation levels from opening blocks.
1825 (let ((opening-block-start-points 1825 (let ((opening-block-start-points