From xemacs-m  Wed Jan 22 14:30:42 1997
Received: from CNRI.Reston.VA.US (CNRI.Reston.VA.US [132.151.1.1])
          by xemacs.org (8.8.4/8.8.4) with SMTP
	  id OAA10367 for <xemacs-beta@xemacs.org>; Wed, 22 Jan 1997 14:30:35 -0600 (CST)
Received: from newcnri.cnri.reston.va.us by CNRI.Reston.VA.US id aa20108;
          22 Jan 97 15:29 EST
Received: from anthem.CNRI.Reston.Va.US by newcnri.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id PAA05561; Wed, 22 Jan 1997 15:29:34 -0500
Received: by anthem.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id PAA28300; Wed, 22 Jan 1997 15:29:33 -0500
Date: Wed, 22 Jan 1997 15:29:33 -0500
Message-Id: <199701222029.PAA28300@anthem.CNRI.Reston.Va.US>
From: "Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US>
To: xemacs-beta@xemacs.org
Subject: imenu.el
Reply-To: "Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US>
X-Attribution: BAW
X-Oblique-Strategy: Repeat a previously succesful strategy
X-WWW-Homepage: http://www.python.org/~bwarsaw


Looks like imenu is now bundled with XEmacs (modes/imenu.el), but
there's a problem with imenu-add-to-menubar if the lookup-key in the
let fails.  I do not use a menubar so code that was calling this
function was getting an error.  Here's a simple patch so that
imenu-add-to-menubar does nothing if the menu-bar is nil.

BTW, does imenu now work with XEmacs?

-Barry

-------------------- snip snip --------------------
*** imenu.el	1997/01/22 20:23:43	1.1
--- imenu.el	1997/01/22 20:25:37
***************
*** 806,815 ****
    (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))
  
--- 806,816 ----
    (let ((newmap (make-sparse-keymap))
  	(menu-bar (lookup-key (current-local-map) [menu-bar])))
!     (if (not menu-bar) nil
!       (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))
  

