From af5c1bebb58a9cbee25c16b96f6725d0e1fabf77 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Thu, 17 May 2012 00:03:13 -0300 Subject: [PATCH] Fixed python-info-current-defun for classes without bases --- lisp/progmodes/python.el | 9 +++++---- 1 file 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 ;;; 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 ".")))) -- 2.39.5