[Top][All Lists]
[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: |
Tue, 06 Nov 2001 08:40:52 -0500 |
> You sent a patch to test for explicit-nil-binding in keymap elements,
> but it seems to be an uninterned symbol and nothing in the patch could
> ever store it in a keymap element. Could I see the whole patch?
You saw the whole patch. The only place where the `explicit-nil-binding'
is introduced is in `store_in_keymap' where we turn a nil binding
into an `explicit-nil-binding'.
> I tend to think that this issue is not very important, and not worth
> paying much price for.
I agree that it's not worth paying much price for, but the patch seems
simple enough and eliminates this special case of dense-keymaps not
doing inheritance properly.
Stefan
--- keymap.c.~1.243.~ Fri Nov 2 18:29:29 2001
+++ keymap.c Sat Nov 3 13:27:00 2001
@@ -103,6 +103,11 @@
/* Which keymaps are reverse-stored in the cache. */
static Lisp_Object where_is_cache_keymaps;
+/* An Qexplicit_nil_binding in a dense keymap means that this is
+ an explicit nil binding which should shadow any parent binding.
+ It's only used internally. */
+static Lisp_Object Qexplicit_nil_binding;
+
static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object,
Lisp_Object));
static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object,
Lisp_Object));
@@ -579,9 +584,17 @@
/* Character codes with modifiers
are not included in a char-table.
All character codes without modifiers are included. */
- if (NATNUMP (idx)
- && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0)
+ if (NATNUMP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0)
+ {
val = Faref (binding, idx);
+ /* `nil' has a special meaning for char-tables, so
+ we use something else to record an explicitly
+ unbound entry. */
+ if (NILP (val))
+ val = Qunbound;
+ else if (EQ (val, Qexplicit_nil_binding))
+ val = Qnil;
+ }
}
/* If we found a binding, clean it up and return it. */
@@ -755,12 +768,13 @@
/* Character codes with modifiers
are not included in a char-table.
All character codes without modifiers are included. */
- if (NATNUMP (idx)
- && ! (XFASTINT (idx)
- & (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
- | CHAR_SHIFT | CHAR_CTL | CHAR_META)))
+ if (NATNUMP (idx) && !(XFASTINT (idx) & CHAR_MODIFIER_MASK))
{
- Faset (elt, idx, def);
+ Faset (elt, idx,
+ /* `nil' has a special meaning for char-tables, so
+ we use something else to record an explicitly
+ unbound entry. */
+ NILP (def) ? Qexplicit_nil_binding : def);
return def;
}
insertion_point = tail;
@@ -3427,6 +3441,9 @@
Qmenu_item = intern ("menu-item");
staticpro (&Qmenu_item);
+
+ Qexplicit_nil_binding = Fmake_symbol (build_string ("explicit-nil-binding"));
+ staticpro (&Qexplicit_nil_binding);
where_is_cache_keymaps = Qt;
where_is_cache = Qnil;
- keymap inheritance for non-sparse keymaps, Miles Bader, 2001/11/01
- Re: keymap inheritance for non-sparse keymaps, Miles Bader, 2001/11/01
- Re: keymap inheritance for non-sparse keymaps, Stefan Monnier, 2001/11/01
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/02
- Re: keymap inheritance for non-sparse keymaps, Miles Bader, 2001/11/02
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/02
- Re: keymap inheritance for non-sparse keymaps, Miles Bader, 2001/11/02
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/04
- Re: keymap inheritance for non-sparse keymaps, Stefan Monnier, 2001/11/04
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/05
- Re: keymap inheritance for non-sparse keymaps,
Stefan Monnier <=
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Kim F. Storm, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Stefan Monnier, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Andreas Schwab, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Stefan Monnier, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/07
- Re: keymap inheritance for non-sparse keymaps, Stefan Monnier, 2001/11/08
- Re: keymap inheritance for non-sparse keymaps, Richard Stallman, 2001/11/10
- Re: keymap inheritance for non-sparse keymaps, Stefan Monnier, 2001/11/12