aboutsummaryrefslogtreecommitdiffstats
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, 5 insertions, 4 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5abfe91809b..2f0393deb65 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -871,8 +871,10 @@ With numeric ARG, just insert that many colons. With
871;;; Navigation 871;;; Navigation
872 872
873(defvar python-nav-beginning-of-defun-regexp 873(defvar python-nav-beginning-of-defun-regexp
874 (python-rx line-start (* space) defun (+ space) symbol-name) 874 (python-rx line-start (* space) defun (+ space) (group symbol-name))
875 "Regular expresion matching beginning of innermost class or function.") 875 "Regular expresion matching beginning of class or function.
876The name of the class or function should be in a group so it can
877be retrieved via `match-string'.")
876 878
877(defun python-nav-beginning-of-defun (&optional nodecorators) 879(defun python-nav-beginning-of-defun (&optional nodecorators)
878 "Move point to `beginning-of-defun'. 880 "Move point to `beginning-of-defun'.
@@ -1960,8 +1962,7 @@ not inside a defun."
1960 (when (or (not min-indent) 1962 (when (or (not min-indent)
1961 (< (current-indentation) min-indent)) 1963 (< (current-indentation) min-indent))
1962 (setq min-indent (current-indentation)) 1964 (setq min-indent (current-indentation))
1963 (back-to-indentation) 1965 (looking-at python-nav-beginning-of-defun-regexp)
1964 (looking-at "\\(?:def\\|class\\) +\\([^(]+\\)[^:]+:\\s-*\n")
1965 (setq names (cons (match-string-no-properties 1) names)))))) 1966 (setq names (cons (match-string-no-properties 1) names))))))
1966 (when names 1967 (when names
1967 (mapconcat (lambda (string) string) names ".")))) 1968 (mapconcat (lambda (string) string) names "."))))