From: Gerd Moellmann Date: Tue, 21 Aug 2001 10:42:27 +0000 (+0000) Subject: (access_keymap): If a binding of the form (GENERIC-CHAR X-Git-Tag: emacs-pretest-21.0.105~132 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=859ea4b849c26f2358bfae8d5b9772b965157831;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 733bde62594..4fdaa860b43 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-08-21 Gerd Moellmann + + * keymap.c (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 a binding + for IDX itself. + 2001-08-16 Gerd Moellmann * xrdb.c (SYSV): Don't define on Solaris 2. 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); } }