diff options
| author | Karl Heuer | 1994-11-16 05:59:53 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-11-16 05:59:53 +0000 |
| commit | 783a283842b6ae0c44375f4c510c3c31333cf194 (patch) | |
| tree | 1e05161b689467460dafe620710024e9470b8714 /src | |
| parent | 36af7d69d4467ad79b18c7de5c12b0ed8cc03e8a (diff) | |
| download | emacs-783a283842b6ae0c44375f4c510c3c31333cf194.tar.gz emacs-783a283842b6ae0c44375f4c510c3c31333cf194.zip | |
(access_keymap): Use type test macros.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keymap.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/keymap.c b/src/keymap.c index fc24d1cd3c5..3ed2a9f416a 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -296,16 +296,15 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 296 | Lisp_Object binding; | 296 | Lisp_Object binding; |
| 297 | 297 | ||
| 298 | binding = XCONS (tail)->car; | 298 | binding = XCONS (tail)->car; |
| 299 | switch (XTYPE (binding)) | 299 | if (SYMBOLP (binding)) |
| 300 | { | 300 | { |
| 301 | case Lisp_Symbol: | ||
| 302 | /* If NOINHERIT, stop finding prefix definitions | 301 | /* If NOINHERIT, stop finding prefix definitions |
| 303 | after we pass a second occurrence of the `keymap' symbol. */ | 302 | after we pass a second occurrence of the `keymap' symbol. */ |
| 304 | if (noinherit && EQ (binding, Qkeymap) && ! EQ (tail, map)) | 303 | if (noinherit && EQ (binding, Qkeymap) && ! EQ (tail, map)) |
| 305 | noprefix = 1; | 304 | noprefix = 1; |
| 306 | break; | 305 | } |
| 307 | 306 | else if (CONSP (binding)) | |
| 308 | case Lisp_Cons: | 307 | { |
| 309 | if (EQ (XCONS (binding)->car, idx)) | 308 | if (EQ (XCONS (binding)->car, idx)) |
| 310 | { | 309 | { |
| 311 | val = XCONS (binding)->cdr; | 310 | val = XCONS (binding)->cdr; |
| @@ -315,17 +314,16 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 315 | } | 314 | } |
| 316 | if (t_ok && EQ (XCONS (binding)->car, Qt)) | 315 | if (t_ok && EQ (XCONS (binding)->car, Qt)) |
| 317 | t_binding = XCONS (binding)->cdr; | 316 | t_binding = XCONS (binding)->cdr; |
| 318 | break; | 317 | } |
| 319 | 318 | else if (VECTORP (binding)) | |
| 320 | case Lisp_Vector: | 319 | { |
| 321 | if (NATNUMP (idx) && XFASTINT (idx) < XVECTOR (binding)->size) | 320 | if (NATNUMP (idx) && XFASTINT (idx) < XVECTOR (binding)->size) |
| 322 | { | 321 | { |
| 323 | val = XVECTOR (binding)->contents[XINT (idx)]; | 322 | val = XVECTOR (binding)->contents[XFASTINT (idx)]; |
| 324 | if (noprefix && CONSP (val) && EQ (XCONS (val)->car, Qkeymap)) | 323 | if (noprefix && CONSP (val) && EQ (XCONS (val)->car, Qkeymap)) |
| 325 | return Qnil; | 324 | return Qnil; |
| 326 | return val; | 325 | return val; |
| 327 | } | 326 | } |
| 328 | break; | ||
| 329 | } | 327 | } |
| 330 | 328 | ||
| 331 | QUIT; | 329 | QUIT; |
| @@ -432,33 +430,31 @@ store_in_keymap (keymap, idx, def) | |||
| 432 | Lisp_Object elt; | 430 | Lisp_Object elt; |
| 433 | 431 | ||
| 434 | elt = XCONS (tail)->car; | 432 | elt = XCONS (tail)->car; |
| 435 | switch (XTYPE (elt)) | 433 | if (VECTORP (elt)) |
| 436 | { | 434 | { |
| 437 | case Lisp_Vector: | ||
| 438 | if (NATNUMP (idx) && XFASTINT (idx) < XVECTOR (elt)->size) | 435 | if (NATNUMP (idx) && XFASTINT (idx) < XVECTOR (elt)->size) |
| 439 | { | 436 | { |
| 440 | XVECTOR (elt)->contents[XFASTINT (idx)] = def; | 437 | XVECTOR (elt)->contents[XFASTINT (idx)] = def; |
| 441 | return def; | 438 | return def; |
| 442 | } | 439 | } |
| 443 | insertion_point = tail; | 440 | insertion_point = tail; |
| 444 | break; | 441 | } |
| 445 | 442 | else if (CONSP (elt)) | |
| 446 | case Lisp_Cons: | 443 | { |
| 447 | if (EQ (idx, XCONS (elt)->car)) | 444 | if (EQ (idx, XCONS (elt)->car)) |
| 448 | { | 445 | { |
| 449 | XCONS (elt)->cdr = def; | 446 | XCONS (elt)->cdr = def; |
| 450 | return def; | 447 | return def; |
| 451 | } | 448 | } |
| 452 | break; | 449 | } |
| 453 | 450 | else if (SYMBOLP (elt)) | |
| 454 | case Lisp_Symbol: | 451 | { |
| 455 | /* If we find a 'keymap' symbol in the spine of KEYMAP, | 452 | /* If we find a 'keymap' symbol in the spine of KEYMAP, |
| 456 | then we must have found the start of a second keymap | 453 | then we must have found the start of a second keymap |
| 457 | being used as the tail of KEYMAP, and a binding for IDX | 454 | being used as the tail of KEYMAP, and a binding for IDX |
| 458 | should be inserted before it. */ | 455 | should be inserted before it. */ |
| 459 | if (EQ (elt, Qkeymap)) | 456 | if (EQ (elt, Qkeymap)) |
| 460 | goto keymap_end; | 457 | goto keymap_end; |
| 461 | break; | ||
| 462 | } | 458 | } |
| 463 | 459 | ||
| 464 | QUIT; | 460 | QUIT; |