emacs-devel
[Top][All Lists]
Advanced

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

Re: keymap inheritance for non-sparse keymaps


From: Stefan Monnier
Subject: Re: keymap inheritance for non-sparse keymaps
Date: Thu, 01 Nov 2001 14:24:00 -0500

>      (setq map (make-keymap))
>      (set-keymap-parent map button-buffer-map)
>      (use-local-map map))
[...] 
> Is it a known problem that keymap inheritance doesn't work properly for
> non-sparse keymaps?  I'd think it was a bug, but I vaguely remember
> this being a misfeature kept around for historical reasons or something.
> 
> I don't see any mention of this in `(elisp)Inheritance and Keymaps'.

It is a known bug to me (it's actually in the BUGS section of
my "work in progress" keymap.c file).  Although I don't think
it's documented anywhere.
The problem is that we want to be able to replace a parent binding with
a non-binding (rather than with another binding), and this is done
by using an explicit binding to nil so that (global-unset-key <key>)
is simply the same as (global-set-key <key> nil).  Now dense keymaps
always map all chars to a value, which (currently) is nil, so they end
up effectively hiding all parent bindings for chars.

So we need to distinguish between an "explicitly unbound" value
and a "no explicit binding" value.  Currently both use nil hence
the problem.

The easiest solution is to initialize the dense keymaps to
some new "no-binding" value (but we can't use Qunbound because this
symbol should stay inaccessible to elisp) and make sure that those
are ignored when traversing a keymap.

I intend to fix this bug, but if someone else wants to do it,
he should feel free.  If you want me to fix it soon, I can also do that
(I have the trivial part of the fix done, but not the "go through the
code and make sure this new value is handled everywhere correctly" yet).


        Stefan




reply via email to

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