emacs-devel
[Top][All Lists]
Advanced

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

Another easymenu problem


From: David PONCE
Subject: Another easymenu problem
Date: Wed, 10 Nov 2004 09:43:22 +0100 (CET)

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)





reply via email to

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