unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David PONCE <david.ponce@wanadoo.fr>
Subject: Another easymenu problem
Date: Wed, 10 Nov 2004 09:43:22 +0100 (CET)	[thread overview]
Message-ID: <23643873.1100076202866.JavaMail.www@wwinf0801> (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)

             reply	other threads:[~2004-11-10  8:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-10  8:43 David PONCE [this message]
2004-11-10 16:18 ` Another easymenu problem Stefan Monnier
2004-11-10 16:47   ` David Ponce
2004-11-10 22:32     ` Stefan
2004-11-10 23:24       ` David Ponce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23643873.1100076202866.JavaMail.www@wwinf0801 \
    --to=david.ponce@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).