(store_in_keymap): Pay attention to the case that idx
authorKenichi Handa <handa@m17n.org>
Sat, 22 Nov 2003 11:04:01 +0000 (11:04 +0000)
committerKenichi Handa <handa@m17n.org>
Sat, 22 Nov 2003 11:04:01 +0000 (11:04 +0000)
is a cons specifying a character range.

src/keymap.c

index dd5bea4..e3d866f 100644 (file)
@@ -826,10 +826,15 @@ store_in_keymap (keymap, idx, def)
   if (!CONSP (keymap) || !EQ (XCAR (keymap), Qkeymap))
     error ("attempt to define a key in a non-keymap");
 
-  /* If idx is a list (some sort of mouse click, perhaps?),
-     the index we want to use is the car of the list, which
-     ought to be a symbol.  */
-  idx = EVENT_HEAD (idx);
+  /* If idx is a cons, and the car part is a character, idx must be of
+     the form (FROM-CHAR . TO-CHAR).  */
+  if (CONSP (idx) && CHARACTERP (XCAR (idx)))
+    CHECK_CHARACTER_CDR (idx);
+  else
+    /* If idx is a list (some sort of mouse click, perhaps?),
+       the index we want to use is the car of the list, which
+       ought to be a symbol.  */
+    idx = EVENT_HEAD (idx);
 
   /* If idx is a symbol, it might have modifiers, which need to
      be put in the canonical order.  */