help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: Removing menu from menu bar


From: Drew Adams
Subject: RE: Removing menu from menu bar
Date: Thu, 5 Jun 2008 09:49:22 -0700

> Is it possible to remove menues from the menu bar that a mode defines,
> without modifying the source code, but rather using a hook, advice, or
> some other device that doesn't touch the source?  For example, if
> xyz-mode defines menues xyz1 and xyz2, can I replace them by 
> a menu xyz
> without altering the source code?  I'm particularly interested in the
> case where the mode defines the menues using easymenu.el.  I'd be
> grateful for any suggestions, code snippets, etc.

Depends on what you mean by "altering the source code". You will need to use
Emacs Lisp to do what you want, but you could do that using M-:.

Defining (which includes removing and redefining) menus is a form of key
binding. Just as you can remove a key binding by binding the key to nil, so you
can remove a menu.

(define-key some-parent-menu [some-menu] nil)
or
(global-unset-key [menu-bar some-menu])

For example, this gets rid of the Dired mode Subdir menu:

(define-key dired-mode-map [menu-bar subdir] nil)





reply via email to

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