]> git.eshelyaron.com Git - emacs.git/commitdiff
(access_keymap): If a binding of the form (GENERIC-CHAR
authorGerd Moellmann <gerd@gnu.org>
Tue, 21 Aug 2001 10:42:27 +0000 (10:42 +0000)
committerGerd Moellmann <gerd@gnu.org>
Tue, 21 Aug 2001 10:42:27 +0000 (10:42 +0000)
. BINDING) exists, where GENERIC-CHAR is the generic character of
the charset of IDX, return BINDING, unless there exists or binding
for IDX itself.

src/ChangeLog
src/keymap.c

index 733bde62594ca4ece65a7b2b103963208c6996b5..4fdaa860b4350e76b57b83da61ef513e7910e8cd 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-21  Gerd Moellmann  <gerd@gnu.org>
+
+       * 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  <gerd@gnu.org>
 
        * xrdb.c (SYSV): Don't define on Solaris 2.
index 5da93ee89f03029d23235c7c81e3f9cc6bf2239c..c4054f3a95a87395767df7802675c1bfd688db75 100644 (file)
@@ -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);
   }
 }