emacs-devel
[Top][All Lists]
Advanced

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

Re: Key Mapping Proposal


From: Eric M. Ludlam
Subject: Re: Key Mapping Proposal
Date: Sat, 16 Jan 2010 09:22:40 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi,

There is a different style of solution for the functions beginning/end of defun. For beginning-of-defun, there is a beginning-of-defun-function. The mode would then override the fcn, and not the keybinding at all. If all 'classic' keybound fcns used this technique, then modes could override the functionality, and a user could override the global keybindings, and get what they want.

To plug my `mode-local' concept again, this tools is designed to make setting up something like beginning-of-defun-function declarative, instead of hand-written functional. Using a common architecture for making functions overridable by mode would make it easier to hit all the common functions that might fall into this catagory.

I developed mode-local for CEDET/Semantic because so much of the parsing/analyzing architecture is mode specific. The result is clean high-level code, and mode specific behaviors.

Eric

Noah Lavine wrote:
Dear emacs-devel,

I'd like to suggest a change to the way modes bind keys, to make it
easier for users to customize keys.

Right now, as far as I can tell, each mode defines some functions and
then binds the appropriate keys to them. There are certain keys that
have conventional meanings, so "C-f" means forward even if you're in
picture-mode, and so on, and modes all try to respect this. The
problem comes if you want to change the meaning of not just one key
sequence, but the convention. Some people might like to use C-f, C-d,
C-s, and C-e to move forward, down, back and up, because they're right
next to each other. In order to achieve this now, you would need to
rebind those keys in each mode that you use. It seems like there
should be a better way.

My suggestion is this: have one location which stores the user's
keybinding for the "forward" key, whatever "forward" means for a
particular mode. Any given mode would then use this to bind their
particular "forward" function to whatever key the user wanted. Do the
same for other keys with conventional meaning, and then modify the
major modes to use these in their keybindings.

One issue that might occur is if the user's bindings for a
conventional key conflict with a binding unique to one particular
major mode. You'd want a system for bouncing the other bindings around
to prevent this, perhaps by keeping a list of unbound keys and then
assigning the functions that need bindings to those keys one by one.
This would give up the ability to give mnemonic key bindings to
functions, but the issue would only occur if the user was customizing
their keys, in which case it seems like the user's preferences should
take priority.

I'm happy to contribute work to this, but I wanted to ask emacs-devel
first to see if you were interested in this, and if so, what you
thought the right approach was.

Thank you
Noah Lavine







reply via email to

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