unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* easy-menu / remove dividers from menu -> fails...
@ 2005-05-26  7:49 David Reitter
  2005-05-26 16:36 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: David Reitter @ 2005-05-26  7:49 UTC (permalink / raw)


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.

Your help would be appreciated!

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

* RE: easy-menu / remove dividers from menu -> fails...
  2005-05-26  7:49 easy-menu / remove dividers from menu -> fails David Reitter
@ 2005-05-26 16:36 ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2005-05-26 16:36 UTC (permalink / raw)


    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.
        
This may not be the kosher or easy-menu way to do it, but...

 (global-unset-key [menu-bar files separator-exit])

A question would be: "Why doesn't easy-menu-remove do the job?"

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

* Re: easy-menu / remove dividers from menu -> fails...
       [not found] <mailman.1868.1117094342.25862.help-gnu-emacs@gnu.org>
@ 2005-05-26 17:29 ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2005-05-26 17:29 UTC (permalink / raw)


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

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

end of thread, other threads:[~2005-05-26 17:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-26  7:49 easy-menu / remove dividers from menu -> fails David Reitter
2005-05-26 16:36 ` Drew Adams
     [not found] <mailman.1868.1117094342.25862.help-gnu-emacs@gnu.org>
2005-05-26 17:29 ` Stefan Monnier

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