GNU bug report logs - #1103
23.0.60; which-func misses functions

Previous Next

Package: emacs;

Reported by: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>

Date: Mon, 6 Oct 2008 22:10:04 UTC

Severity: normal

Tags: moreinfo

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
To: 1103 <at> debbugs.gnu.org
Subject: bug#1103: 23.0.60; which-func misses functions
Date: Tue, 07 Oct 2008 12:48:48 +0200
[Message part 1 (text/plain, inline)]
Lennart Borgman (gmail) wrote:
> Instead of displaying the last function in an elisp file it may display
> the name of a variable that is above the function. I do not know if the
> patch below is the right way to fix it.


Here is a new patch which I think is correct.
[which-func.diff (text/plain, inline)]
Index: which-func.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/which-func.el,v
retrieving revision 1.25
diff -u -r1.25 which-func.el
--- which-func.el	30 Sep 2008 03:42:47 -0000	1.25
+++ which-func.el	7 Oct 2008 10:45:56 -0000
@@ -287,11 +287,12 @@
 	       (boundp 'imenu--index-alist) imenu--index-alist)
       (let ((alist imenu--index-alist)
             (minoffset (point-max))
-            offset pair mark imstack namestack)
+            offset pair mark imstack namestack
+            skip-sub)
         ;; Elements of alist are either ("name" . marker), or
         ;; ("submenu" ("name" . marker) ... ). The list can be
         ;; arbitrarily nested.
-        (while (or alist imstack)
+        (while (or alist imstack skip-sub)
           (if alist
               (progn
                 (setq pair (car-safe alist)
@@ -302,9 +303,12 @@
                       ((imenu--subalist-p pair)
                        (setq imstack   (cons alist imstack)
                              namestack (cons (car pair) namestack)
-                             alist     (cdr pair)))
+                             alist     (cdr pair)
+                             skip-sub  nil
+                             ))
 
                       ((number-or-marker-p (setq mark (cdr pair)))
+                       (unless skip-sub
                        (if (>= (setq offset (- (point) mark)) 0)
                            (if (< offset minoffset) ; find the closest item
                                (setq minoffset offset
@@ -312,12 +316,15 @@
                                            which-func-imenu-joiner-function
                                            (reverse (cons (car pair) namestack)))))
                          ;; Entries in order, so can skip all those after point.
-                         (setq alist nil
-                               imstack nil)))))
+                           ;;(setq alist nil imstack nil)
+                           (setq skip-sub t)
+                           )
+                         ))))
 
             (setq alist     (car imstack)
                   namestack (cdr namestack)
-                  imstack   (cdr imstack))))))
+                  imstack   (cdr imstack)
+                  skip-sub  nil)))))
 
     ;; Try using add-log support.
     (when (and (null name) (boundp 'add-log-current-defun-function)

This bug report was last modified 14 years and 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.