emacs-devel
[Top][All Lists]
Advanced

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

Re: menu-bar-map


From: Stefan Monnier
Subject: Re: menu-bar-map
Date: Wed, 23 Apr 2008 11:23:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Is it possible to create a variable, menu-bar-map say, that overrides the
> the global menu bar just like tool-bar-map does for the tool bar?

The following "should work" (it doesn't):

  (defvar hide-menu-bar-map
          (let ((map (make-sparse-keymap)))
            (define-key map [menu-bar] 'undefined)
            map))

  (defvar my-special-mode-map
          (let ((map (make-sparse-keymap)))
            (set-keymap-parent map hide-menu-bar-map)
            (define-key [menu-bar] (make-sparse-keymap))
            (define-key [menu-bar foo] '(menu-item "Foo" foo-menu))
            map))

If my-special-mode-map is passed to use-local-map, it should hide all
the bindings in [menu-bar] from the global-map.  IIUC this will work in
the sense that those global menu entries will indeed not work, tho
they'll still be displayed (yup: a bug).

Note that it will not hide or break the higher-precedence menus, such as
the ones coming from minor-modes.

> I'm thinking that it might be useful for small windows, e.g., to display
> watch expressions in a debug session, where the global menu bar would
> use all the visible area.

I'm not sure what you mean.  Since the menu-bar is per-frame I assume
that by "window" you mean "frame", in which case you can just hide the
menu-bar via frame-parameters.


        Stefan




reply via email to

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