aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2003-11-24 02:46:11 +0000
committerKenichi Handa2003-11-24 02:46:11 +0000
commitafc9166aa352f64761fd9ecf7bf100611bf115f7 (patch)
tree9ba4772f4b18dc53f6cd01a05926332ea0d16720 /src
parent9ecf9e75e0b682960b08bea8214f6c8b86cf2566 (diff)
downloademacs-afc9166aa352f64761fd9ecf7bf100611bf115f7.tar.gz
emacs-afc9166aa352f64761fd9ecf7bf100611bf115f7.zip
(store_in_keymap): Pay attention to the case that idx is a cons
specifying a character range.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/keymap.c b/src/keymap.c
index e3d866f4756..174b32de795 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -870,6 +870,19 @@ store_in_keymap (keymap, idx, def)
870 ASET (elt, XFASTINT (idx), def); 870 ASET (elt, XFASTINT (idx), def);
871 return def; 871 return def;
872 } 872 }
873 else if (CONSP (idx) && CHARACTERP (XCAR (idx)))
874 {
875 int from = XFASTINT (XCAR (idx));
876 int to = XFASTINT (XCDR (idx));
877
878 if (to >= ASIZE (elt))
879 to = ASIZE (elt) - 1;
880 for (; from <= to; from++)
881 ASET (elt, from, def);
882 if (to == XFASTINT (XCDR (idx)))
883 /* We have defined all keys in IDX. */
884 return def;
885 }
873 insertion_point = tail; 886 insertion_point = tail;
874 } 887 }
875 else if (CHAR_TABLE_P (elt)) 888 else if (CHAR_TABLE_P (elt))
@@ -900,6 +913,19 @@ store_in_keymap (keymap, idx, def)
900 XSETCDR (elt, def); 913 XSETCDR (elt, def);
901 return def; 914 return def;
902 } 915 }
916 else if (CONSP (idx) && CHARACTERP (XCAR (idx)))
917 {
918 int from = XFASTINT (XCAR (idx));
919 int to = XFASTINT (XCDR (idx));
920
921 if (from <= XFASTINT (XCAR (elt))
922 && to >= XFASTINT (XCAR (elt)))
923 {
924 XSETCDR (elt, def);
925 if (from == to)
926 return def;
927 }
928 }
903 } 929 }
904 else if (EQ (elt, Qkeymap)) 930 else if (EQ (elt, Qkeymap))
905 /* If we find a 'keymap' symbol in the spine of KEYMAP, 931 /* If we find a 'keymap' symbol in the spine of KEYMAP,
@@ -914,8 +940,21 @@ store_in_keymap (keymap, idx, def)
914 keymap_end: 940 keymap_end:
915 /* We have scanned the entire keymap, and not found a binding for 941 /* We have scanned the entire keymap, and not found a binding for
916 IDX. Let's add one. */ 942 IDX. Let's add one. */
917 XSETCDR (insertion_point, 943 {
918 Fcons (Fcons (idx, def), XCDR (insertion_point))); 944 Lisp_Object elt;
945
946 if (CONSP (idx) && CHARACTERP (XCAR (idx)))
947 {
948 /* IDX specifies a range of characters, and not all of them
949 were handled yet, which means this keymap doesn't have a
950 char-table. So, we insert a char-table now. */
951 elt = Fmake_char_table (Qkeymap, Qnil);
952 Fset_char_table_range (elt, idx, NILP (def) ? Qt : def);
953 }
954 else
955 elt = Fcons (idx, def);
956 XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point)));
957 }
919 } 958 }
920 959
921 return def; 960 return def;