emacs-devel
[Top][All Lists]
Advanced

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

RE: menu indications of key bindings for remapped commands


From: Drew Adams
Subject: RE: menu indications of key bindings for remapped commands
Date: Sun, 20 May 2007 16:54:07 -0700

I reported this bug in January, but I have not heard anything since. It is
still a bug, as of a build from March 21. Any news?

> From: Drew Adams Sent: Monday, January 22, 2007 11:44 AM
> >     > It's a bug.
> >     > Could you give a test case?
> >
> >     See my previous mail. Just create a menu using a command that is the
> >     *target* of a command remapping.
> >
> > That is not a test case, that is a general description.  A test case
> > is code we can execute and see the failure.
>
> Try this in emacs -Q
>
> (defvar bar-mode-map (make-sparse-keymap)
>   "Keymap for Bar mode.")
> (defvar bar-menu-map (make-sparse-keymap "Bar")
>   "Keymap for Bar menu.")
>
> (define-key bar-mode-map [menu-bar bar]
>   (cons "Bar" bar-menu-map))
> (define-key bar-mode-map [remap switch-to-buffer]
>   'bar-buffer)
>
> ;; This way, the key binding shows incorrectly in the menu.
> (define-key bar-menu-map [bar-buffer]
>   '("Bar Buffer..." . bar-buffer))
>
> ;; This way, the key binding shows correctly in the menu.
> ;;(define-key bar-menu-map [bar-buffer]
> ;;  '("Bar Buffer..." . switch-to-buffer))
>
> (define-minor-mode bar-mode "Bar mode")
>
> M-x bar-mode
>
> You'll see the bad menu item (bad key-binding description) in menu Bar.
>
> Now execute the commented code. The menu item is now as it should be.
>
> --
>
> Interestingly, this apparently has something to do with the
> minor-mode map,
> because similar code using the global map does not have the same
> problem. It
> shows, however, no binding at all in the menu item.
>
> (defvar foo-menu-map (make-sparse-keymap "Foo")
>   "Keymap for Foo menu.")
>
> (define-key global-map [menu-bar foo]
>   (cons "Foo" foo-menu-map))
> (define-key global-map [remap switch-to-buffer]
>   'foo-buffer)
>
> ;; This way, there is no key binding in the menu.
> (define-key foo-menu-map [foo-buffer]
>   '("Foo Buffer..." . foo-buffer))
>
> ;; This way, the key binding shows correctly in the menu.
> ;;(define-key foo-menu-map [foo-buffer]
> ;;  '("Foo Buffer..." . switch-to-buffer))






reply via email to

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