unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: 1103@emacsbugs.donarmstrong.com
Subject: bug#1103: 23.0.60; which-func misses functions
Date: Tue, 07 Oct 2008 12:48:48 +0200	[thread overview]
Message-ID: <48EB3E90.9010709@gmail.com> (raw)
In-Reply-To: <48EA8A9D.8020103@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

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.

[-- Attachment #2: which-func.diff --]
[-- Type: text/plain, Size: 2439 bytes --]

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)

  reply	other threads:[~2008-10-07 10:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-06 22:01 bug#1103: 23.0.60; which-func misses functions Lennart Borgman (gmail)
2008-10-07 10:48 ` Lennart Borgman (gmail) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-10-08 16:19 Chong Yidong
2008-10-08 23:22 ` Lennart Borgman (gmail)
2008-10-09  0:45   ` Lennart Borgman (gmail)
2008-10-09 18:18     ` Lennart Borgman (gmail)
2008-10-09 20:00       ` Chong Yidong
2008-10-09 20:40         ` Lennart Borgman (gmail)
2011-07-15 21:08         ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48EB3E90.9010709@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=1103@emacsbugs.donarmstrong.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).