diff options
| author | Kenichi Handa | 2004-10-01 08:04:10 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-10-01 08:04:10 +0000 |
| commit | c2affe3638128e765243addf956caf1d30da45b7 (patch) | |
| tree | 09b70c5cafc70c1046e06da563f7ba5524125f95 | |
| parent | ed1ae069fd2c8652f6cec917ba94f5f95546cdd7 (diff) | |
| download | emacs-c2affe3638128e765243addf956caf1d30da45b7.tar.gz emacs-c2affe3638128e765243addf956caf1d30da45b7.zip | |
(where_is_internal_2): Fix for the case that KEY is a
cons. Append the found sequences in car of ARGS instead of
prepending.
| -rw-r--r-- | src/keymap.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/src/keymap.c b/src/keymap.c index 36e33f9610f..dfa060a66f1 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2666,12 +2666,15 @@ remapped command in the returned list. */) | |||
| 2666 | 2666 | ||
| 2667 | /* This is the function that Fwhere_is_internal calls using map_char_table. | 2667 | /* This is the function that Fwhere_is_internal calls using map_char_table. |
| 2668 | ARGS has the form | 2668 | ARGS has the form |
| 2669 | (((DEFINITION . NOINDIRECT) . (KEYMAP . RESULT)) | 2669 | (((DEFINITION . NOINDIRECT) . RESULT) |
| 2670 | . | 2670 | . |
| 2671 | ((THIS . LAST) . (NOMENUS . LAST_IS_META))) | 2671 | ((THIS . LAST) . (NOMENUS . LAST_IS_META))) |
| 2672 | Since map_char_table doesn't really use the return value from this function, | 2672 | Since map_char_table doesn't really use the return value from this function, |
| 2673 | we the result append to RESULT, the slot in ARGS. | 2673 | we the result append to RESULT, the slot in ARGS. |
| 2674 | 2674 | ||
| 2675 | KEY may be a cons (FROM . TO) where both FROM and TO are integers | ||
| 2676 | (i.e. character events). | ||
| 2677 | |||
| 2675 | This function can GC because it calls where_is_internal_1 which can | 2678 | This function can GC because it calls where_is_internal_1 which can |
| 2676 | GC. */ | 2679 | GC. */ |
| 2677 | 2680 | ||
| @@ -2685,7 +2688,6 @@ where_is_internal_2 (args, key, binding) | |||
| 2685 | struct gcpro gcpro1, gcpro2, gcpro3; | 2688 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2686 | 2689 | ||
| 2687 | GCPRO3 (args, key, binding); | 2690 | GCPRO3 (args, key, binding); |
| 2688 | result = XCDR (XCAR (args)); | ||
| 2689 | definition = XCAR (XCAR (XCAR (args))); | 2691 | definition = XCAR (XCAR (XCAR (args))); |
| 2690 | noindirect = XCDR (XCAR (XCAR (args))); | 2692 | noindirect = XCDR (XCAR (XCAR (args))); |
| 2691 | this = XCAR (XCAR (XCDR (args))); | 2693 | this = XCAR (XCAR (XCDR (args))); |
| @@ -2693,11 +2695,40 @@ where_is_internal_2 (args, key, binding) | |||
| 2693 | nomenus = XFASTINT (XCAR (XCDR (XCDR (args)))); | 2695 | nomenus = XFASTINT (XCAR (XCDR (XCDR (args)))); |
| 2694 | last_is_meta = XFASTINT (XCDR (XCDR (XCDR (args)))); | 2696 | last_is_meta = XFASTINT (XCDR (XCDR (XCDR (args)))); |
| 2695 | 2697 | ||
| 2696 | sequence = where_is_internal_1 (binding, key, definition, noindirect, | 2698 | result = Qnil; |
| 2697 | this, last, nomenus, last_is_meta); | 2699 | if (CONSP (key) && INTEGERP (XCAR (key)) && INTEGERP (XCDR (key))) |
| 2700 | { | ||
| 2701 | /* Try all ASCII characters. Try also non-ASCII characters but | ||
| 2702 | only the first and last one because trying all of them is | ||
| 2703 | extremely memory and time consuming. | ||
| 2704 | |||
| 2705 | Fixme: Perhaps it should be allowed to store a cons directly | ||
| 2706 | in RESULT. -- handa@m17n.org */ | ||
| 2707 | int from = XINT (XCAR (key)), to = XINT (XCDR (key)); | ||
| 2708 | Lisp_Object k; | ||
| 2709 | |||
| 2710 | for (; from <= to; from++) | ||
| 2711 | { | ||
| 2712 | k = make_number (from); | ||
| 2713 | sequence = where_is_internal_1 (binding, k, definition, noindirect, | ||
| 2714 | this, last, nomenus, last_is_meta); | ||
| 2715 | if (!NILP (sequence)) | ||
| 2716 | result = Fcons (sequence, result); | ||
| 2717 | if (from >= 128 && from < to) | ||
| 2718 | from = to - 1; | ||
| 2719 | } | ||
| 2720 | result = Fnreverse (result); | ||
| 2721 | } | ||
| 2722 | else | ||
| 2723 | { | ||
| 2724 | sequence = where_is_internal_1 (binding, key, definition, noindirect, | ||
| 2725 | this, last, nomenus, last_is_meta); | ||
| 2726 | if (!NILP (sequence)) | ||
| 2727 | result = Fcons (sequence, Qnil); | ||
| 2728 | } | ||
| 2698 | 2729 | ||
| 2699 | if (!NILP (sequence)) | 2730 | if (! NILP (result)) |
| 2700 | XSETCDR (XCAR (args), Fcons (sequence, result)); | 2731 | nconc2 (XCAR (args), result); |
| 2701 | 2732 | ||
| 2702 | UNGCPRO; | 2733 | UNGCPRO; |
| 2703 | } | 2734 | } |