]> code.delx.au - gnu-emacs/commitdiff
python-info-current-defun: fixed cornercase that caused imenu to break
authorFabián Ezequiel Gallina <fgallina@cuca>
Thu, 17 May 2012 03:03:19 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:19 +0000 (00:03 -0300)
lisp/progmodes/python.el

index 5262fa160f996f258342a813a39b1a85a980638c..949c112ee757216a4698b15a334dbb5a598a750f 100644 (file)
@@ -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