diff options
| author | Richard M. Stallman | 1993-05-14 22:11:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-14 22:11:17 +0000 |
| commit | 926a64aa20421cd96161cdb85de9ab23ce002b83 (patch) | |
| tree | 895e27cf62a0cee3ef21e83e08bd9ddf5791bd59 /src/keymap.c | |
| parent | 0e9d6dd34bb0d2e7e41971655737e005d157ba95 (diff) | |
| download | emacs-926a64aa20421cd96161cdb85de9ab23ce002b83.tar.gz emacs-926a64aa20421cd96161cdb85de9ab23ce002b83.zip | |
(access_keymap): Handle any length vector.
(store_in_keymap): Likewise.
(Fcopy_keymap): Likewise.
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/keymap.c b/src/keymap.c index 345d65fe768..d6b9468cae4 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -90,7 +90,7 @@ static void describe_map_2 (); | |||
| 90 | 90 | ||
| 91 | DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 1, 0, | 91 | DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 1, 0, |
| 92 | "Construct and return a new keymap, of the form (keymap VECTOR . ALIST).\n\ | 92 | "Construct and return a new keymap, of the form (keymap VECTOR . ALIST).\n\ |
| 93 | VECTOR is a 128-element vector which holds the bindings for the ASCII\n\ | 93 | VECTOR is a vector which holds the bindings for the ASCII\n\ |
| 94 | characters. ALIST is an assoc-list which holds bindings for function keys,\n\ | 94 | characters. ALIST is an assoc-list which holds bindings for function keys,\n\ |
| 95 | mouse events, and any other things that appear in the input stream.\n\ | 95 | mouse events, and any other things that appear in the input stream.\n\ |
| 96 | All entries in it are initially nil, meaning \"command undefined\".\n\n\ | 96 | All entries in it are initially nil, meaning \"command undefined\".\n\n\ |
| @@ -170,10 +170,11 @@ synkey (frommap, fromchar, tomap, tochar) | |||
| 170 | DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0, | 170 | DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0, |
| 171 | "Return t if ARG is a keymap.\n\ | 171 | "Return t if ARG is a keymap.\n\ |
| 172 | \n\ | 172 | \n\ |
| 173 | A keymap is a list (keymap . ALIST), a list (keymap VECTOR . ALIST),\n\ | 173 | A keymap is a list (keymap . ALIST),\n\ |
| 174 | or a symbol whose function definition is a keymap is itself a keymap.\n\ | 174 | or a symbol whose function definition is a keymap is itself a keymap.\n\ |
| 175 | ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);\n\ | 175 | ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);\n\ |
| 176 | VECTOR is a 128-element vector of bindings for ASCII characters.") | 176 | a vector of densely packed bindings for small character codes\n\ |
| 177 | is also allowed as an element.") | ||
| 177 | (object) | 178 | (object) |
| 178 | Lisp_Object object; | 179 | Lisp_Object object; |
| 179 | { | 180 | { |
| @@ -290,10 +291,9 @@ access_keymap (map, idx, t_ok) | |||
| 290 | break; | 291 | break; |
| 291 | 292 | ||
| 292 | case Lisp_Vector: | 293 | case Lisp_Vector: |
| 293 | if (XVECTOR (binding)->size == DENSE_TABLE_SIZE | 294 | if (XTYPE (idx) == Lisp_Int |
| 294 | && XTYPE (idx) == Lisp_Int | ||
| 295 | && XINT (idx) >= 0 | 295 | && XINT (idx) >= 0 |
| 296 | && XINT (idx) < DENSE_TABLE_SIZE) | 296 | && XINT (idx) < XVECTOR (binding)->size) |
| 297 | return XVECTOR (binding)->contents[XINT (idx)]; | 297 | return XVECTOR (binding)->contents[XINT (idx)]; |
| 298 | break; | 298 | break; |
| 299 | } | 299 | } |
| @@ -389,10 +389,8 @@ store_in_keymap (keymap, idx, def) | |||
| 389 | switch (XTYPE (elt)) | 389 | switch (XTYPE (elt)) |
| 390 | { | 390 | { |
| 391 | case Lisp_Vector: | 391 | case Lisp_Vector: |
| 392 | if (XVECTOR (elt)->size != DENSE_TABLE_SIZE) | ||
| 393 | break; | ||
| 394 | if (XTYPE (idx) == Lisp_Int | 392 | if (XTYPE (idx) == Lisp_Int |
| 395 | && XINT (idx) >= 0 && XINT (idx) < DENSE_TABLE_SIZE) | 393 | && XINT (idx) >= 0 && XINT (idx) < XVECTOR (elt)->size) |
| 396 | { | 394 | { |
| 397 | XVECTOR (elt)->contents[XFASTINT (idx)] = def; | 395 | XVECTOR (elt)->contents[XFASTINT (idx)] = def; |
| 398 | return def; | 396 | return def; |
| @@ -450,15 +448,14 @@ is not copied.") | |||
| 450 | { | 448 | { |
| 451 | Lisp_Object elt = XCONS (tail)->car; | 449 | Lisp_Object elt = XCONS (tail)->car; |
| 452 | 450 | ||
| 453 | if (XTYPE (elt) == Lisp_Vector | 451 | if (XTYPE (elt) == Lisp_Vector) |
| 454 | && XVECTOR (elt)->size == DENSE_TABLE_SIZE) | ||
| 455 | { | 452 | { |
| 456 | int i; | 453 | int i; |
| 457 | 454 | ||
| 458 | elt = Fcopy_sequence (elt); | 455 | elt = Fcopy_sequence (elt); |
| 459 | XCONS (tail)->car = elt; | 456 | XCONS (tail)->car = elt; |
| 460 | 457 | ||
| 461 | for (i = 0; i < DENSE_TABLE_SIZE; i++) | 458 | for (i = 0; i < XVECTOR (elt)->size; i++) |
| 462 | if (XTYPE (XVECTOR (elt)->contents[i]) != Lisp_Symbol | 459 | if (XTYPE (XVECTOR (elt)->contents[i]) != Lisp_Symbol |
| 463 | && Fkeymapp (XVECTOR (elt)->contents[i])) | 460 | && Fkeymapp (XVECTOR (elt)->contents[i])) |
| 464 | XVECTOR (elt)->contents[i] = | 461 | XVECTOR (elt)->contents[i] = |