summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 2fe88323c35..bbabce80b4d 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -5854,7 +5854,14 @@ statement."
(save-excursion
(python-nav-beginning-of-statement)
(when (and (not (python-syntax-context-type))
- (looking-at (python-rx dedenter)))
+ (looking-at (python-rx dedenter))
+ ;; Exclude the first "case" in the block.
+ (not (and (string= (match-string-no-properties 0)
+ "case")
+ (save-excursion
+ (back-to-indentation)
+ (python-util-forward-comment -1)
+ (equal (char-before) ?:)))))
(point))))
(defun python-info-line-ends-backslash-p (&optional line-number)