[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1103: 23.0.60; which-func misses functions
From: |
Lennart Borgman (gmail) |
Subject: |
bug#1103: 23.0.60; which-func misses functions |
Date: |
Tue, 07 Oct 2008 12:48:48 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
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.
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)