From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:03:19 +0000 (-0300) Subject: python-info-current-defun: fixed cornercase that caused imenu to break X-Git-Tag: emacs-24.2.90~1199^2~556 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0b7b2e512dcad0b81d284414856bb9cb5da5f434;p=emacs.git python-info-current-defun: fixed cornercase that caused imenu to break --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5262fa160f9..949c112ee75 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2149,7 +2149,8 @@ This function is compatible to be used as `add-log-current-defun-function' since it returns nil if point is not inside a defun." (let ((names '()) - (min-indent)) + (min-indent) + (first-run t)) (save-restriction (widen) (save-excursion @@ -2157,7 +2158,9 @@ not inside a defun." (forward-comment -9999) (setq min-indent (current-indentation)) (while (python-beginning-of-defun-function 1 t) - (when (< (current-indentation) min-indent) + (when (or (< (current-indentation) min-indent) + first-run) + (setq first-run nil) (setq min-indent (current-indentation)) (looking-at python-nav-beginning-of-defun-regexp) (setq names (cons