emacs-devel
[Top][All Lists]
Advanced

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

Re: Enhancements to "minor-mode-map-alist" functionality.


From: Stefan Monnier
Subject: Re: Enhancements to "minor-mode-map-alist" functionality.
Date: Mon, 15 Apr 2002 08:34:51 -0400

> The fundamental problem is that some modes (like viper and cua) makes
> some quite fundamental changes to the way some of the standard keys
> works [cua remaps C-c and C-x depending on the current state of the
> mark (and other conditions), while viper operates in command or insert
> mode].

BTW: some code in keyboard.c does something very much like function-key-map,
except in a hard-coded way (drop down-mouse events if they're unbound,
turn doube-clicks into single clicks if unbound, turn upper case into
lower case if unbound, my own local code has added down-modifier
and up-modifier events (I wanted to see if we could get a behavior
similar to Windows' Alt-TAB thingy which requires catching the up-Alt
event) and has correspondingly added code to drop those modifiers
if they're not bound, ...).
I was thinking of adding some kind of predicate binding, halfway
between normal bindings and default bindings.  Something like

        (define-key function-key-map [uppercase-p] 'map-to-lowercase)

where uppercase-p is a function that takes an event and returns a boolean.
In your case maybe you could save some keymap handling by doing something like

        (define-key cua-mode-map [conditional-control-x] 'cua-cut)

where conditional-control-x returns non-nil iff the event is C-x and
the mark is active.  Or maybe in your specific case we could more
simply reuse something existing:

        (define-key cua-mode-map [?\C-x]
          '(menu-item "cut" 'cua-cut :enable mark-active))

Making this work might be a simple matter of a few lines in get_keyelt.


        Stefan




reply via email to

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