diff options
| author | Miles Bader | 2006-08-16 14:08:49 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-08-16 14:08:49 +0000 |
| commit | de20e0ccdb039a2ac27e5bbd3e06ab70c4e7bb65 (patch) | |
| tree | 80243ce02b52cbf7945c614bd213dd63142b861a /src/keyboard.c | |
| parent | 7a5c2a42040b12b037940a067aee6ac6fde01680 (diff) | |
| parent | 5ebdc2990a95cc38b21f772eea4de3ceee149e54 (diff) | |
| download | emacs-de20e0ccdb039a2ac27e5bbd3e06ab70c4e7bb65.tar.gz emacs-de20e0ccdb039a2ac27e5bbd3e06ab70c4e7bb65.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 382-398)
- Update from CVS
- Update from erc--emacs--22
- Fix ERC bug introduced in last patch
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 123-125)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-101
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 45d5832a905..62c862f69d1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -100,6 +100,9 @@ int interrupt_input_pending; | |||
| 100 | /* File descriptor to use for input. */ | 100 | /* File descriptor to use for input. */ |
| 101 | extern int input_fd; | 101 | extern int input_fd; |
| 102 | 102 | ||
| 103 | /* Nonzero if we are executing from the SIGIO signal handler. */ | ||
| 104 | int in_sighandler; | ||
| 105 | |||
| 103 | #ifdef HAVE_WINDOW_SYSTEM | 106 | #ifdef HAVE_WINDOW_SYSTEM |
| 104 | /* Make all keyboard buffers much bigger when using X windows. */ | 107 | /* Make all keyboard buffers much bigger when using X windows. */ |
| 105 | #ifdef MAC_OS8 | 108 | #ifdef MAC_OS8 |
| @@ -2403,7 +2406,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2403 | EMACS_TIME *end_time; | 2406 | EMACS_TIME *end_time; |
| 2404 | { | 2407 | { |
| 2405 | volatile Lisp_Object c; | 2408 | volatile Lisp_Object c; |
| 2406 | int count; | 2409 | int count, jmpcount; |
| 2407 | jmp_buf local_getcjmp; | 2410 | jmp_buf local_getcjmp; |
| 2408 | jmp_buf save_jump; | 2411 | jmp_buf save_jump; |
| 2409 | volatile int key_already_recorded = 0; | 2412 | volatile int key_already_recorded = 0; |
| @@ -2629,11 +2632,13 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2629 | around any call to sit_for or kbd_buffer_get_event; | 2632 | around any call to sit_for or kbd_buffer_get_event; |
| 2630 | it *must not* be in effect when we call redisplay. */ | 2633 | it *must not* be in effect when we call redisplay. */ |
| 2631 | 2634 | ||
| 2635 | jmpcount = SPECPDL_INDEX (); | ||
| 2632 | if (_setjmp (local_getcjmp)) | 2636 | if (_setjmp (local_getcjmp)) |
| 2633 | { | 2637 | { |
| 2634 | /* We must have saved the outer value of getcjmp here, | 2638 | /* We must have saved the outer value of getcjmp here, |
| 2635 | so restore it now. */ | 2639 | so restore it now. */ |
| 2636 | restore_getcjmp (save_jump); | 2640 | restore_getcjmp (save_jump); |
| 2641 | unbind_to (jmpcount, Qnil); | ||
| 2637 | XSETINT (c, quit_char); | 2642 | XSETINT (c, quit_char); |
| 2638 | internal_last_event_frame = selected_frame; | 2643 | internal_last_event_frame = selected_frame; |
| 2639 | Vlast_event_frame = internal_last_event_frame; | 2644 | Vlast_event_frame = internal_last_event_frame; |
| @@ -2674,7 +2679,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2674 | goto non_reread; | 2679 | goto non_reread; |
| 2675 | } | 2680 | } |
| 2676 | 2681 | ||
| 2677 | timer_start_idle (); | 2682 | /* Start idle timers if no time limit is supplied. We don't do it |
| 2683 | if a time limit is supplied to avoid an infinite recursion in the | ||
| 2684 | situation where an idle timer calls `sit-for'. */ | ||
| 2685 | |||
| 2686 | if (!end_time) | ||
| 2687 | timer_start_idle (); | ||
| 2678 | 2688 | ||
| 2679 | /* If in middle of key sequence and minibuffer not active, | 2689 | /* If in middle of key sequence and minibuffer not active, |
| 2680 | start echoing if enough time elapses. */ | 2690 | start echoing if enough time elapses. */ |
| @@ -2744,7 +2754,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2744 | c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); | 2754 | c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); |
| 2745 | 2755 | ||
| 2746 | /* Now that we have read an event, Emacs is not idle. */ | 2756 | /* Now that we have read an event, Emacs is not idle. */ |
| 2747 | timer_stop_idle (); | 2757 | if (!end_time) |
| 2758 | timer_stop_idle (); | ||
| 2748 | 2759 | ||
| 2749 | goto exit; | 2760 | goto exit; |
| 2750 | } | 2761 | } |
| @@ -2874,7 +2885,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2874 | /* Actually read a character, waiting if necessary. */ | 2885 | /* Actually read a character, waiting if necessary. */ |
| 2875 | save_getcjmp (save_jump); | 2886 | save_getcjmp (save_jump); |
| 2876 | restore_getcjmp (local_getcjmp); | 2887 | restore_getcjmp (local_getcjmp); |
| 2877 | timer_start_idle (); | 2888 | if (!end_time) |
| 2889 | timer_start_idle (); | ||
| 2878 | c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); | 2890 | c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); |
| 2879 | restore_getcjmp (save_jump); | 2891 | restore_getcjmp (save_jump); |
| 2880 | 2892 | ||
| @@ -2926,7 +2938,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2926 | 2938 | ||
| 2927 | non_reread: | 2939 | non_reread: |
| 2928 | 2940 | ||
| 2929 | timer_stop_idle (); | 2941 | if (!end_time) |
| 2942 | timer_stop_idle (); | ||
| 2930 | RESUME_POLLING; | 2943 | RESUME_POLLING; |
| 2931 | 2944 | ||
| 2932 | if (NILP (c)) | 2945 | if (NILP (c)) |
| @@ -2960,7 +2973,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 2960 | last_input_char = c; | 2973 | last_input_char = c; |
| 2961 | Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); | 2974 | Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); |
| 2962 | 2975 | ||
| 2963 | if (CONSP (c) && EQ (XCAR (c), Qselect_window)) | 2976 | if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) |
| 2964 | /* We stopped being idle for this event; undo that. This | 2977 | /* We stopped being idle for this event; undo that. This |
| 2965 | prevents automatic window selection (under | 2978 | prevents automatic window selection (under |
| 2966 | mouse_autoselect_window from acting as a real input event, for | 2979 | mouse_autoselect_window from acting as a real input event, for |
| @@ -3166,7 +3179,8 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) | |||
| 3166 | show_help_echo (help, window, object, position, 0); | 3179 | show_help_echo (help, window, object, position, 0); |
| 3167 | 3180 | ||
| 3168 | /* We stopped being idle for this event; undo that. */ | 3181 | /* We stopped being idle for this event; undo that. */ |
| 3169 | timer_resume_idle (); | 3182 | if (!end_time) |
| 3183 | timer_resume_idle (); | ||
| 3170 | goto retry; | 3184 | goto retry; |
| 3171 | } | 3185 | } |
| 3172 | 3186 | ||
| @@ -3952,13 +3966,15 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 3952 | { | 3966 | { |
| 3953 | EMACS_TIME duration; | 3967 | EMACS_TIME duration; |
| 3954 | EMACS_GET_TIME (duration); | 3968 | EMACS_GET_TIME (duration); |
| 3955 | EMACS_SUB_TIME (duration, *end_time, duration); | 3969 | if (EMACS_TIME_GE (duration, *end_time)) |
| 3956 | if (EMACS_TIME_NEG_P (duration)) | 3970 | return Qnil; /* finished waiting */ |
| 3957 | return Qnil; | ||
| 3958 | else | 3971 | else |
| 3959 | wait_reading_process_output (EMACS_SECS (duration), | 3972 | { |
| 3960 | EMACS_USECS (duration), | 3973 | EMACS_SUB_TIME (duration, *end_time, duration); |
| 3961 | -1, 1, Qnil, NULL, 0); | 3974 | wait_reading_process_output (EMACS_SECS (duration), |
| 3975 | EMACS_USECS (duration), | ||
| 3976 | -1, 1, Qnil, NULL, 0); | ||
| 3977 | } | ||
| 3962 | } | 3978 | } |
| 3963 | else | 3979 | else |
| 3964 | wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); | 3980 | wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); |
| @@ -6920,6 +6936,8 @@ input_available_signal (signo) | |||
| 6920 | SIGNAL_THREAD_CHECK (signo); | 6936 | SIGNAL_THREAD_CHECK (signo); |
| 6921 | #endif | 6937 | #endif |
| 6922 | 6938 | ||
| 6939 | in_sighandler = 1; | ||
| 6940 | |||
| 6923 | if (input_available_clear_time) | 6941 | if (input_available_clear_time) |
| 6924 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6942 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6925 | 6943 | ||
| @@ -6931,6 +6949,7 @@ input_available_signal (signo) | |||
| 6931 | sigfree (); | 6949 | sigfree (); |
| 6932 | #endif | 6950 | #endif |
| 6933 | errno = old_errno; | 6951 | errno = old_errno; |
| 6952 | in_sighandler = 0; | ||
| 6934 | } | 6953 | } |
| 6935 | #endif /* SIGIO */ | 6954 | #endif /* SIGIO */ |
| 6936 | 6955 | ||
| @@ -8381,7 +8400,15 @@ follow_key (key, nmaps, current, defs, next) | |||
| 8381 | such as Vfunction_key_map and Vkey_translation_map. */ | 8400 | such as Vfunction_key_map and Vkey_translation_map. */ |
| 8382 | typedef struct keyremap | 8401 | typedef struct keyremap |
| 8383 | { | 8402 | { |
| 8384 | Lisp_Object map, parent; | 8403 | /* This is the map originally specified for this use. */ |
| 8404 | Lisp_Object parent; | ||
| 8405 | /* This is a submap reached by looking up, in PARENT, | ||
| 8406 | the events from START to END. */ | ||
| 8407 | Lisp_Object map; | ||
| 8408 | /* Positions [START, END) in the key sequence buffer | ||
| 8409 | are the key that we have scanned so far. | ||
| 8410 | Those events are the ones that we will replace | ||
| 8411 | if PAREHT maps them into a key sequence. */ | ||
| 8385 | int start, end; | 8412 | int start, end; |
| 8386 | } keyremap; | 8413 | } keyremap; |
| 8387 | 8414 | ||
| @@ -8454,7 +8481,11 @@ keyremap_step (keybuf, bufsize, fkey, input, doit, diff, prompt) | |||
| 8454 | Lisp_Object next, key; | 8481 | Lisp_Object next, key; |
| 8455 | 8482 | ||
| 8456 | key = keybuf[fkey->end++]; | 8483 | key = keybuf[fkey->end++]; |
| 8457 | next = access_keymap_keyremap (fkey->map, key, prompt, doit); | 8484 | |
| 8485 | if (KEYMAPP (fkey->parent)) | ||
| 8486 | next = access_keymap_keyremap (fkey->map, key, prompt, doit); | ||
| 8487 | else | ||
| 8488 | next = Qnil; | ||
| 8458 | 8489 | ||
| 8459 | /* If keybuf[fkey->start..fkey->end] is bound in the | 8490 | /* If keybuf[fkey->start..fkey->end] is bound in the |
| 8460 | map and we're in a position to do the key remapping, replace it with | 8491 | map and we're in a position to do the key remapping, replace it with |
| @@ -8652,9 +8683,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8652 | delayed_switch_frame = Qnil; | 8683 | delayed_switch_frame = Qnil; |
| 8653 | fkey.map = fkey.parent = Vfunction_key_map; | 8684 | fkey.map = fkey.parent = Vfunction_key_map; |
| 8654 | keytran.map = keytran.parent = Vkey_translation_map; | 8685 | keytran.map = keytran.parent = Vkey_translation_map; |
| 8655 | /* If there is no translation-map, turn off scanning. */ | 8686 | fkey.start = fkey.end = 0; |
| 8656 | fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; | 8687 | keytran.start = keytran.end = 0; |
| 8657 | keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; | ||
| 8658 | 8688 | ||
| 8659 | if (INTERACTIVE) | 8689 | if (INTERACTIVE) |
| 8660 | { | 8690 | { |
| @@ -9481,8 +9511,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 9481 | 9511 | ||
| 9482 | keybuf[t - 1] = new_key; | 9512 | keybuf[t - 1] = new_key; |
| 9483 | mock_input = max (t, mock_input); | 9513 | mock_input = max (t, mock_input); |
| 9484 | fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; | 9514 | fkey.start = fkey.end = 0; |
| 9485 | keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; | 9515 | keytran.start = keytran.end = 0; |
| 9486 | 9516 | ||
| 9487 | goto replay_sequence; | 9517 | goto replay_sequence; |
| 9488 | } | 9518 | } |
| @@ -10786,6 +10816,7 @@ init_keyboard () | |||
| 10786 | do_mouse_tracking = Qnil; | 10816 | do_mouse_tracking = Qnil; |
| 10787 | #endif | 10817 | #endif |
| 10788 | input_pending = 0; | 10818 | input_pending = 0; |
| 10819 | in_sighandler = 0; | ||
| 10789 | 10820 | ||
| 10790 | /* This means that command_loop_1 won't try to select anything the first | 10821 | /* This means that command_loop_1 won't try to select anything the first |
| 10791 | time through. */ | 10822 | time through. */ |