]> git.eshelyaron.com Git - emacs.git/commitdiff
Fixed python-info-current-defun for classes without bases
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:13 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:13 +0000 (00:03 -0300)
lisp/progmodes/python.el

index 5abfe91809b03e2105b7d2107f876d068d0d89ff..2f0393deb6500588a5c14757f071ed93592e811d 100644 (file)
@@ -871,8 +871,10 @@ With numeric ARG, just insert that many colons.  With
 ;;; Navigation
 
 (defvar python-nav-beginning-of-defun-regexp
-  (python-rx line-start (* space) defun (+ space) symbol-name)
-  "Regular expresion matching beginning of innermost class or function.")
+  (python-rx line-start (* space) defun (+ space) (group symbol-name))
+  "Regular expresion matching beginning of class or function.
+The name of the class or function should be in a group so it can
+be retrieved via `match-string'.")
 
 (defun python-nav-beginning-of-defun (&optional nodecorators)
   "Move point to `beginning-of-defun'.
@@ -1960,8 +1962,7 @@ not inside a defun."
           (when (or (not min-indent)
                     (< (current-indentation) min-indent))
             (setq min-indent (current-indentation))
-            (back-to-indentation)
-            (looking-at "\\(?:def\\|class\\) +\\([^(]+\\)[^:]+:\\s-*\n")
+            (looking-at python-nav-beginning-of-defun-regexp)
             (setq names (cons (match-string-no-properties 1) names))))))
     (when names
       (mapconcat (lambda (string) string) names "."))))