emacs-devel
[Top][All Lists]
Advanced

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

RE: customizing key definitions with Customize


From: Drew Adams
Subject: RE: customizing key definitions with Customize
Date: Wed, 14 May 2008 21:46:48 -0700

>     what the user will see: all current key bindings in this keymap
>     (this may be too many as some keymaps have dozens of key 
>     bindings),
>     or an empty list with the single [Insert] button to add new key
>     bindings that will override the existing ones after saving the
>     Customization buffer.
> 
> Perhaps we should handle this with two alternatives, like
> customization of fonts.  You can customize a font either in terms of
> its appearance in the current kind of screen, or its general 
> conditions that apply to all kinds of screens.

Perhaps we should handle it as I suggested: customize an option. A keymap-valued
symbol is just a variable. Either such a variable could itself be made a user
option or, as I showed, a separate but corresponding user option can be created.
Both approaches can be treated the same way (e.g. as I indicated); it depends on
what we want.

If we want a given keymap variable itself to be completely customizable (i.e.,
for all of its keys), then we can just make it a defcustom of the sort I
indicated. If we want some keymap variables not to be options, then we need not
use defcustom for them. If we want a given keymap variable to have only some of
its keys customizable (at least by default), then we can create a separate user
option that corresponds to only those keys.

The code I sent indicates how to do this. As I said, to make the option's
customizable key definitions be the only ones in the keymap, it is enough to
change the :set function I used so that it first empties the keymap, before it
adds the customized keys.

That is, if a keymap variable is to be completely customizable, then that is
what we would want to do: make sure that :set not only adds bindings but also
changes and deletes existing bindings. That is the same :set function I sent,
but with the addition of a preliminary operation that empties the keymap, so
that setting the option makes the keymap reflect just those key definitions that
are present.

Unlike faces, keymaps, apart from keymap-valued variables, do not have names, so
the approach I suggested makes sense: customize keymap variables, not
"first-class" keymap objects.

We could instead entertain the idea of treating keymaps like faces - giving them
names independently of using variables, but I don't see the point in that. It
should be enough to turn, say, `lisp-mode-map' into a defcustom of the sort that
I indicated, if we want to make it entirely customizable.






reply via email to

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