aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-05-17 00:03:13 -0300
committerFabián Ezequiel Gallina2012-05-17 00:03:13 -0300
commitaf5c1bebb58a9cbee25c16b96f6725d0e1fabf77 (patch)
tree7b1c8590db9043185dfcea46aba0ef292303227e
parent74d7b6051a6392f7de1ef4ef5d6b30e3f582d1b6 (diff)
downloademacs-af5c1bebb58a9cbee25c16b96f6725d0e1fabf77.tar.gz
emacs-af5c1bebb58a9cbee25c16b96f6725d0e1fabf77.zip
Fixed python-info-current-defun for classes without bases
-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 "."))))