unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: easy-menu / remove dividers from menu -> fails...
Date: Thu, 26 May 2005 13:29:37 -0400	[thread overview]
Message-ID: <874qcprj67.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: <mailman.1868.1117094342.25862.help-gnu-emacs@gnu.org> (David Reitter's message of "Thu, 26 May 2005 08:49:21 +0100")

The following message is a courtesy copy of an article
that has been posted to gnu.emacs.help as well.

> How do I delete divider bars from a menu?
> Deleting normal items works, deleting the divider bar doesn't:

> (easy-menu-remove-item global-map '("menu-bar" "file") 'exit-emacs)    ;works
> (easy-menu-remove-item global-map '("menu-bar" "file") 'separator-exit);doesn't work

> The latter just doesn't do anything.

The problem is a bug in easy-menu.
The patch below fixes it in your case.


        Stefan


--- orig/lisp/emacs-lisp/easymenu.el
+++ mod/lisp/emacs-lisp/easymenu.el
@@ -549,7 +549,14 @@
   "In menu MENU try to look for menu item with name NAME.
 If a menu item is found, return (NAME . item), otherwise return nil.
 If item is an old format item, a new format item is returned."
-  (let ((item (lookup-key menu (vector (easy-menu-intern name))))
+  ;; The call to `lookup-key' also calls the C function `get_keyelt' which
+  ;; looks inside a menu-item to only return the actual command.  This is
+  ;; not what we want here.  We should either add an arg to lookup-key to be
+  ;; able to turn off this "feature", or else we could use map-keymap here.
+  ;; In the mean time, I just use `assq' which is an OK approximation since
+  ;; menus are rarely built from vectors or char-tables.
+  (let ((item (or (cdr (assq name menu))
+                  (lookup-key menu (vector (easy-menu-intern name)))))
 	ret enable cache label)
     (cond
      ((stringp (car-safe item))

           reply	other threads:[~2005-05-26 17:29 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <mailman.1868.1117094342.25862.help-gnu-emacs@gnu.org>]

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=874qcprj67.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /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).