[Top][All Lists]

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

menu-bar key bindings and derived modes

From: Stephen Berman
Subject: menu-bar key bindings and derived modes
Date: 05 May 2002 23:27:11 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

The following message is a courtesy copy of an article
that has been posted to as well.

I've defined a derived mode of a major mode I'm working on, and for it
a mode-map consisting of key binding definitions that amount to a
proper subset of the major-mode-map key binding definitions.  E.g., I
have something like the following:

(defvar my-major-mode-map
  (let ((map (make-keymap)))
    (define-key map "a" 'my-function-1)
    (define-key map "b" 'my-function-2)

(defvar my-derived-mode-map
  (let ((map (make-keymap)))
    (define-key map "a" 'my-function-1)

For the major mode I've defined a menu via easy-menu-define, which
displays e.g. the following entries:

my-function-1           (a)
my-function-2           (b)

When I switch to a buffer which uses the derived mode, the menu bar
still contains the major mode menu, which now looks like this:

my-function-1           (a)

But when I switch back to the major mode buffer, its menu now retains
the latter menu display (i.e., lacking the `b' key binding listing).
This persists for the life of the Emacs session, regardless of whether
I kill the buffers and reload them.  What do I have to do to get the
first menu display when I switch back to the major-mode buffer?

--Steve Berman

reply via email to

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