unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: menu indications of key bindings for remapped commands
Date: Mon, 22 Jan 2007 11:44:22 -0800	[thread overview]
Message-ID: <EIENLHALHGIMHGDOLMIMOEGHCOAA.drew.adams@oracle.com> (raw)
In-Reply-To: <E1H5ucC-00006T-2w@fencepost.gnu.org>

>     > 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	other threads:[~2007-01-22 19:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 22:24 menu indications of key bindings for remapped commands Drew Adams
2007-01-10 23:37 ` Stefan Monnier
2007-01-13  5:49   ` Drew Adams
2007-01-14  1:56     ` Richard Stallman
2007-01-22 19:44       ` Drew Adams [this message]
2007-05-20 23:54         ` Drew Adams
2007-05-24 21:22           ` Richard Stallman
2007-01-11  9:42 ` Kim F. Storm
     [not found] <EIENLHALHGIMHGDOLMIMMEEFCOAA.drew.adams@oracle.com>
2007-01-11 18:15 ` Drew Adams
2007-01-11 21:29   ` Kim F. Storm
2007-01-12  2:06     ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2007-01-11 18:32 Drew Adams
2007-01-11 21:33 ` Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EIENLHALHGIMHGDOLMIMOEGHCOAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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