[Top][All Lists]
[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: |
Mon, 22 Jan 2007 11:44:22 -0800 |
> > 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))