From 0b7b2e512dcad0b81d284414856bb9cb5da5f434 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Thu, 17 May 2012 00:03:19 -0300 Subject: [PATCH] python-info-current-defun: fixed cornercase that caused imenu to break --- lisp/progmodes/python.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.39.5