diff options
| author | Gerd Moellmann | 2001-08-21 10:42:27 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-08-21 10:42:27 +0000 |
| commit | 859ea4b849c26f2358bfae8d5b9772b965157831 (patch) | |
| tree | e3ab1e36f87cb93bc36c6077af7e59a6fab46a92 /src/keymap.c | |
| parent | 67e2eec4e9563e7fbc2d6d998162902877f7c76f (diff) | |
| download | emacs-859ea4b849c26f2358bfae8d5b9772b965157831.tar.gz emacs-859ea4b849c26f2358bfae8d5b9772b965157831.zip | |
(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 or binding
for IDX itself.
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/keymap.c b/src/keymap.c index 5da93ee89f0..c4054f3a95a 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -502,8 +502,11 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 502 | { | 502 | { |
| 503 | Lisp_Object tail; | 503 | Lisp_Object tail; |
| 504 | Lisp_Object t_binding; | 504 | Lisp_Object t_binding; |
| 505 | Lisp_Object generic_binding; | ||
| 505 | 506 | ||
| 506 | t_binding = Qnil; | 507 | t_binding = Qnil; |
| 508 | generic_binding = Qnil; | ||
| 509 | |||
| 507 | for (tail = XCDR (map); | 510 | for (tail = XCDR (map); |
| 508 | (CONSP (tail) | 511 | (CONSP (tail) |
| 509 | || (tail = get_keymap (tail, 0, autoload), CONSP (tail))); | 512 | || (tail = get_keymap (tail, 0, autoload), CONSP (tail))); |
| @@ -521,7 +524,10 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 521 | } | 524 | } |
| 522 | else if (CONSP (binding)) | 525 | else if (CONSP (binding)) |
| 523 | { | 526 | { |
| 524 | if (EQ (XCAR (binding), idx)) | 527 | Lisp_Object key = XCAR (binding); |
| 528 | int c1, c2, charset; | ||
| 529 | |||
| 530 | if (EQ (key, idx)) | ||
| 525 | { | 531 | { |
| 526 | val = XCDR (binding); | 532 | val = XCDR (binding); |
| 527 | if (noprefix && KEYMAPP (val)) | 533 | if (noprefix && KEYMAPP (val)) |
| @@ -530,7 +536,21 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 530 | fix_submap_inheritance (map, idx, val); | 536 | fix_submap_inheritance (map, idx, val); |
| 531 | return get_keyelt (val, autoload); | 537 | return get_keyelt (val, autoload); |
| 532 | } | 538 | } |
| 533 | if (t_ok && EQ (XCAR (binding), Qt)) | 539 | else if (INTEGERP (idx) |
| 540 | && INTEGERP (key) | ||
| 541 | && !SINGLE_BYTE_CHAR_P (XINT (idx)) | ||
| 542 | && !SINGLE_BYTE_CHAR_P (XINT (key)) | ||
| 543 | && CHAR_VALID_P (XINT (key), 1) | ||
| 544 | && !CHAR_VALID_P (XINT (key), 0) | ||
| 545 | && (CHAR_CHARSET (XINT (key)) | ||
| 546 | == CHAR_CHARSET (XINT (idx)))) | ||
| 547 | { | ||
| 548 | /* KEY is the generic character of the charset of IDX. | ||
| 549 | Use KEY's binding if there isn't a binding for IDX | ||
| 550 | itself. */ | ||
| 551 | generic_binding = binding; | ||
| 552 | } | ||
| 553 | else if (t_ok && EQ (XCAR (binding), Qt)) | ||
| 534 | t_binding = XCDR (binding); | 554 | t_binding = XCDR (binding); |
| 535 | } | 555 | } |
| 536 | else if (VECTORP (binding)) | 556 | else if (VECTORP (binding)) |
| @@ -567,6 +587,9 @@ access_keymap (map, idx, t_ok, noinherit, autoload) | |||
| 567 | QUIT; | 587 | QUIT; |
| 568 | } | 588 | } |
| 569 | 589 | ||
| 590 | if (!NILP (generic_binding)) | ||
| 591 | return get_keyelt (generic_binding, autoload); | ||
| 592 | |||
| 570 | return get_keyelt (t_binding, autoload); | 593 | return get_keyelt (t_binding, autoload); |
| 571 | } | 594 | } |
| 572 | } | 595 | } |