unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Another easymenu problem
@ 2004-11-10  8:43 David PONCE
  2004-11-10 16:18 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: David PONCE @ 2004-11-10  8:43 UTC (permalink / raw)


Hi All,

I discovered another problem with easy-menu-get-map that breaks some
external libraries like igrep.el.

Here is an example of what is failing with the latest CVS version of
easymenu.el, and which works as expected in Emacs 21.3:

(easy-menu-define my-menu nil
  "My menu."
  '("My menu" :active may-be
    ["An item" do-something :help "Text"]))
=> nil

my-menu
=> menu-function-35

(easy-menu-add-item nil '("MyMenuBarEntry") my-menu)
Fails with:

Debugger entered--Lisp error: (wrong-type-argument listp menu-function-35)
  easy-menu-add-item(nil ("MyMenuBarEntry") menu-function-35)
  eval((easy-menu-add-item nil (quote ("MyMenuBarEntry")) my-menu))
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp()
  call-interactively(eval-print-last-sexp)

I think the problem is in `easy-menu-get-map' which in 21.3 always
returns a keymap in its list form, but can return a keymap in a symbol
form in latest CVS version.

I fixed that with the following patch, however I am not sure it is the
right thing to do. So please review.

Regards
David

Index: easymenu.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/easymenu.el,v
retrieving revision 1.69
diff -c -r1.69 easymenu.el
*** easymenu.el	9 Nov 2004 14:37:09 -0000	1.69
--- easymenu.el	10 Nov 2004 08:04:05 -0000
***************
*** 631,637 ****
  		(apply 'vector (mapcar 'easy-menu-intern path))
  		(if name (cons name newmap) newmap))
  	      newmap))))
!   (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map))
    map)
  
  (provide 'easymenu)
--- 631,640 ----
  		(apply 'vector (mapcar 'easy-menu-intern path))
  		(if name (cons name newmap) newmap))
  	      newmap))))
!   (if (keymapp map)
!       (while (and (symbolp map) (keymapp map))
!         (setq map (symbol-function map)))
!     (error "Malformed menu in easy-menu: (%s)" map))
    map)
  
  (provide 'easymenu)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-10 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-10  8:43 Another easymenu problem David PONCE
2004-11-10 16:18 ` Stefan Monnier
2004-11-10 16:47   ` David Ponce
2004-11-10 22:32     ` Stefan
2004-11-10 23:24       ` David Ponce

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).