[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

speedbar gets imenu lists upside-down!

From: Kevin Broadey
Subject: speedbar gets imenu lists upside-down!
Date: Thu, 15 Mar 2001 17:19:29 GMT

In GNU Emacs 20.6.1 (sparc-sun-solaris2.6, X toolkit)
 of Mon Jul  3 2000 on bah108
configured using `configure  --prefix=/tools.local/emacs-20.6 
--bindir=/tools.local/emacs-20.6/bin/SunOS --with-x-toolkit=lucid'

The speedbar buffer shows imenu-generated lists upside-down.  To reproduce,
put the following in a file "c.c":-

int a (void)

int b (void)

int c (void)

Visit the file (C-x C-f) then run M-x speedbar to create the speedbar frame
(I'm running under X-Windows).  Middle-click on the "+" beside "c.c" and
you see this:-

1: [-] c.c !
2:  > c
2:  > b
2:  > a

This is annoying!

It's particuarly annoying because I'm working on a function that runs from
`imenu-create-index-function' in outline-mode and outline-minor-mode
buffers to create a menu from the outline headings.  It works fine with
imenu proper, but it's unusable from speedbar as it's upside-down.

Here's imenu-outline.el if anyone's interested.  It should really go
straight into outline.el.  It's a but simple at the moment, just creating a
flat alist.  I need to make it nest sub-alists for the different outline

(defun imenu-outline-create-index ()
  (let (imenu-alist imenu-level)
    (goto-char (point-max))
    (while (not (bobp))
      (if (outline-on-heading-p)
          (let ((item-level (outline-level))
                (item-name (buffer-substring
                            (save-excursion (and (looking-at outline-regexp)
                                                 (goto-char (match-end 0)))
                                            (skip-chars-forward " \t")
                            (save-excursion (outline-end-of-heading)
                                            (skip-chars-backward " \t")
                (item-pos (point)))
            (setq imenu-alist (cons (cons item-name item-pos)  imenu-alist))))
      (outline-previous-visible-heading 1))

(defun imenu-outline-setup ()
  (setq imenu-create-index-function 'imenu-outline-create-index))

(add-hook 'outline-mode-hook 'imenu-outline-setup)
(add-hook 'outline-minor-mode-hook 'imenu-outline-setup)

I did have an imenu-outline.el a few years ago, but I've lost it.  I think
it stopped working when emacs 20.6 came out so I deleted it.  I can't
remember who the author was either, maybe Lars Lindberg or Per Abrahamsen.
Anyone know anything about this?

Kevin Broadey

reply via email to

[Prev in Thread] Current Thread [Next in Thread]