From xemacs-m  Wed Jan 22 17:03:53 1997
Received: from atreides.mindspring.com (atreides.mindspring.com [204.180.142.236])
          by xemacs.org (8.8.4/8.8.4) with SMTP
	  id RAA11414 for <xemacs-beta@xemacs.org>; Wed, 22 Jan 1997 17:03:53 -0600 (CST)
Received: (qmail 18385 invoked by uid 52477); 22 Jan 1997 23:03:43 -0000
Sender: sj@atreides.mindspring.com
To: XEmacs beta <xemacs-beta@xemacs.org>
Subject: Re: imenu.el
References: <199701222029.PAA28300@anthem.CNRI.Reston.Va.US> <xcd4tg9tmp0.fsf@gargoyle164.cs.uchicago.edu>
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: text/plain; charset=US-ASCII
From: Sudish Joseph <sudish@mindspring.com>
Date: 22 Jan 1997 18:03:43 -0500
In-Reply-To: Soren Dayton's message of 22 Jan 1997 15:38:35 -0600
Message-ID: <yviaafq19usw.fsf@atreides.mindspring.com>
Lines: 59
X-Mailer: Red Gnus v0.82/XEmacs 20.0

Soren Dayton writes:
> Not really.  I was looking at fixing that, but my courses have been
> claiming nearly all my time in the last two weeks.  Joseph Sudish had
> some patches to make the mouse event stuff work, but there is still a
> problem that keymaps are treated as lists rather than some sort of
> opaque data structure. Note the nconc's in the code below...

The problem isn't with keymaps as such, it's with the menu generation
code.  Menus under GNU Emacs work off of keymaps, so when imenu has to
generate menus on the fly, it generates a keymap.  We don't need any
special keymap handling under XEmacs.

The best way to do this in XEmacs is to use the :filter hook provided
by add-submenu.  Here's the part of the patch I sent in earlier that
pertains to Barry's patch.  I edited the patch, so it's unusable--but
it's readable.

If you use my earlier patch, all that remains is to get
imenu-update-menubar to return a menu.  I.e., it takes the
imenu generated list of functions and creates a menu and returns it. 

This hunk is a good example of why XEmacs menu interface is so much
cooler. :-)

-Sudish


*** 785,830 ****
  NAME is a string used to name the menu bar item.
  See the command `imenu' for more information."
    (interactive "sImenu menu item name: ")
!   (let ((newmap (make-sparse-keymap))
! 	(menu-bar (lookup-key (current-local-map) [menu-bar])))
!     (define-key newmap [menu-bar]
!       (append (make-sparse-keymap) menu-bar))
!     (define-key newmap [menu-bar index]
!       (cons name (nconc (make-sparse-keymap "Imenu")
! 			(make-sparse-keymap))))
!     (use-local-map (append newmap (current-local-map))))
!   (add-hook 'menu-bar-update-hook 'imenu-update-menubar))
  
  (defvar imenu-buffer-menubar nil)
  
  (defun imenu-update-menubar ()
	[snipped]
  
  (defun imenu--menubar-select (item)
    "Use Imenu to select the function or variable named in this menu item."
--- 785,821 ----
  NAME is a string used to name the menu bar item.
  See the command `imenu' for more information."
    (interactive "sImenu menu item name: ")
!   (set-buffer-menubar current-menubar)
!   (add-submenu nil `(,name :filter imenu-update-menubar)))
  
  (defvar imenu-buffer-menubar nil)
  
  (defun imenu-update-menubar ()
	[snipped]

