emacs-devel
[Top][All Lists]
Advanced

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

Re: [CVS] f7, f8 bound..


From: Stefan Monnier
Subject: Re: [CVS] f7, f8 bound..
Date: Mon, 09 Sep 2002 09:35:14 -0400

> But what's does it mean to delete a key binding?

Right now, I think we can assume it's "defined" by the definition
of global-unset-key (which indeed binds the key to nil).

> Or should it restore a default key binding from bindings.el ?

Huh?  We're talking about "any random keymap", so there's no reason
why it should have any relationship with bindings.el.
For one, the keymap might never be used directly (see vc-prefix-map
for an example which is only ever used after the C-x v prefix).

> Or is it a combination of the two -  if the current key binding
> is set from custom, deleting means: remove the custom binding and
> restore the default binding; otherwise, remove the default binding.

I think you're thinking about "what if the user drops a change?"
(either an addition or a removal).  In that case, we might indeed
want to reset the binding to what it was before custom started
to mess with the map.
That's indeed the main difficulty.  Per's solution is to either
rebuild the whole keymap each time (which requires saving its
original value somewhere) or use two maps.
The "two maps" approach is a possibility.
Basically, the idea is to keep the original map as the parent
of the actual map.  So when custom changes the map, it does:

        (let ((orig (keymap-parent map)))
          (setq map (make-sparse-keymap))
          (set-keymap-parent map orig)
          ...add/remove bindings...)

The problem is that any changes made to `map' rather than to its parent
are lost without regards to whether the changes were made by custom or not.


        Stefan





reply via email to

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