summaryrefslogtreecommitdiff
path: root/src/keymap.c
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-08-21 10:42:27 +0000
committerGerd Moellmann <gerd@gnu.org>2001-08-21 10:42:27 +0000
commit859ea4b849c26f2358bfae8d5b9772b965157831 (patch)
treee3ab1e36f87cb93bc36c6077af7e59a6fab46a92 /src/keymap.c
parent67e2eec4e9563e7fbc2d6d998162902877f7c76f (diff)
downloademacs-859ea4b849c26f2358bfae8d5b9772b965157831.tar.gz
(access_keymap): If a binding of the form (GENERIC-CHAR
. BINDING) exists, where GENERIC-CHAR is the generic character of the charset of IDX, return BINDING, unless there exists or binding for IDX itself.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 5da93ee89f0..c4054f3a95a 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -502,8 +502,11 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
{
Lisp_Object tail;
Lisp_Object t_binding;
+ Lisp_Object generic_binding;
t_binding = Qnil;
+ generic_binding = Qnil;
+
for (tail = XCDR (map);
(CONSP (tail)
|| (tail = get_keymap (tail, 0, autoload), CONSP (tail)));
@@ -521,7 +524,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
}
else if (CONSP (binding))
{
- if (EQ (XCAR (binding), idx))
+ Lisp_Object key = XCAR (binding);
+ int c1, c2, charset;
+
+ if (EQ (key, idx))
{
val = XCDR (binding);
if (noprefix && KEYMAPP (val))
@@ -530,7 +536,21 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
fix_submap_inheritance (map, idx, val);
return get_keyelt (val, autoload);
}
- if (t_ok && EQ (XCAR (binding), Qt))
+ else if (INTEGERP (idx)
+ && INTEGERP (key)
+ && !SINGLE_BYTE_CHAR_P (XINT (idx))
+ && !SINGLE_BYTE_CHAR_P (XINT (key))
+ && CHAR_VALID_P (XINT (key), 1)
+ && !CHAR_VALID_P (XINT (key), 0)
+ && (CHAR_CHARSET (XINT (key))
+ == CHAR_CHARSET (XINT (idx))))
+ {
+ /* KEY is the generic character of the charset of IDX.
+ Use KEY's binding if there isn't a binding for IDX
+ itself. */
+ generic_binding = binding;
+ }
+ else if (t_ok && EQ (XCAR (binding), Qt))
t_binding = XCDR (binding);
}
else if (VECTORP (binding))
@@ -567,6 +587,9 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
QUIT;
}
+ if (!NILP (generic_binding))
+ return get_keyelt (generic_binding, autoload);
+
return get_keyelt (t_binding, autoload);
}
}