Mercurial > emacs
comparison src/keyboard.c @ 83541:694bbb62a75d
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-371
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-372
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-373
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-374
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-375
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-376
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-377
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-378
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-379
Merge from erc--emacs--21
* emacs@sv.gnu.org/emacs--devo--0--patch-380
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-381
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-382
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-383
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-384
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-385
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-386
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-387
Fix ERC bug introduced in last patch
* emacs@sv.gnu.org/emacs--devo--0--patch-388
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-389
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-390
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-391
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-392
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-393
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-394
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-395
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-396
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-397
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-398
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-399
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-400
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-401
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-402
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-403
Rcirc update from Ryan Yeske
* emacs@sv.gnu.org/emacs--devo--0--patch-404
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-405
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-406
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-407
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-408
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-409
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-410
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-411
Miscellaneous tq-related fixes.
* emacs@sv.gnu.org/emacs--devo--0--patch-412
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-121
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-122
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-123
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-124
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-125
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-126
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-127
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-581
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 14 Oct 2006 16:56:21 +0000 |
parents | 4a2f192917db 0798c7030130 |
children | 2d56e13fd23d |
comparison
equal
deleted
inserted
replaced
83540:0c89a85addc3 | 83541:694bbb62a75d |
---|---|
1455 Fthrow (Qexit, Qt); | 1455 Fthrow (Qexit, Qt); |
1456 | 1456 |
1457 error ("No recursive edit is in progress"); | 1457 error ("No recursive edit is in progress"); |
1458 return Qnil; | 1458 return Qnil; |
1459 } | 1459 } |
1460 | |
1461 #ifdef HAVE_MOUSE | |
1462 | |
1463 /* Restore mouse tracking enablement. See Ftrack_mouse for the only use | |
1464 of this function. */ | |
1465 | |
1466 static Lisp_Object | |
1467 tracking_off (old_value) | |
1468 Lisp_Object old_value; | |
1469 { | |
1470 do_mouse_tracking = old_value; | |
1471 if (NILP (old_value)) | |
1472 { | |
1473 /* Redisplay may have been preempted because there was input | |
1474 available, and it assumes it will be called again after the | |
1475 input has been processed. If the only input available was | |
1476 the sort that we have just disabled, then we need to call | |
1477 redisplay. */ | |
1478 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) | |
1479 { | |
1480 redisplay_preserve_echo_area (6); | |
1481 get_input_pending (&input_pending, | |
1482 READABLE_EVENTS_DO_TIMERS_NOW); | |
1483 } | |
1484 } | |
1485 return Qnil; | |
1486 } | |
1487 | |
1488 DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0, | |
1489 doc: /* Evaluate BODY with mouse movement events enabled. | |
1490 Within a `track-mouse' form, mouse motion generates input events that | |
1491 you can read with `read-event'. | |
1492 Normally, mouse motion is ignored. | |
1493 usage: (track-mouse BODY ...) */) | |
1494 (args) | |
1495 Lisp_Object args; | |
1496 { | |
1497 int count = SPECPDL_INDEX (); | |
1498 Lisp_Object val; | |
1499 | |
1500 record_unwind_protect (tracking_off, do_mouse_tracking); | |
1501 | |
1502 do_mouse_tracking = Qt; | |
1503 | |
1504 val = Fprogn (args); | |
1505 return unbind_to (count, val); | |
1506 } | |
1507 | |
1508 /* If mouse has moved on some frame, return one of those frames. | |
1509 Return 0 otherwise. */ | |
1510 | |
1511 static FRAME_PTR | |
1512 some_mouse_moved () | |
1513 { | |
1514 Lisp_Object tail, frame; | |
1515 | |
1516 FOR_EACH_FRAME (tail, frame) | |
1517 { | |
1518 if (XFRAME (frame)->mouse_moved) | |
1519 return XFRAME (frame); | |
1520 } | |
1521 | |
1522 return 0; | |
1523 } | |
1524 | |
1525 #endif /* HAVE_MOUSE */ | |
1460 | 1526 |
1461 /* This is the actual command reading loop, | 1527 /* This is the actual command reading loop, |
1462 sans error-handling encapsulation. */ | 1528 sans error-handling encapsulation. */ |
1463 | 1529 |
1464 static int read_key_sequence P_ ((Lisp_Object *, int, Lisp_Object, | 1530 static int read_key_sequence P_ ((Lisp_Object *, int, Lisp_Object, |
2104 | 2170 |
2105 static Lisp_Object | 2171 static Lisp_Object |
2106 safe_run_hooks_1 (hook) | 2172 safe_run_hooks_1 (hook) |
2107 Lisp_Object hook; | 2173 Lisp_Object hook; |
2108 { | 2174 { |
2175 if (NILP (Vrun_hooks)) | |
2176 return Qnil; | |
2109 return call1 (Vrun_hooks, Vinhibit_quit); | 2177 return call1 (Vrun_hooks, Vinhibit_quit); |
2110 } | 2178 } |
2111 | 2179 |
2112 /* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ | 2180 /* Subroutine for safe_run_hooks: handle an error by clearing out the hook. */ |
2113 | 2181 |
2386 return; | 2454 return; |
2387 } | 2455 } |
2388 | 2456 |
2389 #ifdef HAVE_MOUSE | 2457 #ifdef HAVE_MOUSE |
2390 if (!noninteractive && STRINGP (help)) | 2458 if (!noninteractive && STRINGP (help)) |
2391 help = call1 (Qmouse_fixup_help_message, help); | 2459 { |
2460 /* The mouse-fixup-help-message Lisp function can call | |
2461 mouse_position_hook, which resets the mouse_moved flags. | |
2462 This causes trouble if we are trying to read a mouse motion | |
2463 event (i.e., if we are inside a `track-mouse' form), so we | |
2464 restore the mouse_moved flag. */ | |
2465 FRAME_PTR f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved (); | |
2466 help = call1 (Qmouse_fixup_help_message, help); | |
2467 if (f) | |
2468 f->mouse_moved = 1; | |
2469 } | |
2392 #endif | 2470 #endif |
2393 | 2471 |
2394 if (STRINGP (help) || NILP (help)) | 2472 if (STRINGP (help) || NILP (help)) |
2395 { | 2473 { |
2396 if (!NILP (Vshow_help_function)) | 2474 if (!NILP (Vshow_help_function)) |
2481 Lisp_Object prev_event; | 2559 Lisp_Object prev_event; |
2482 int *used_mouse_menu; | 2560 int *used_mouse_menu; |
2483 EMACS_TIME *end_time; | 2561 EMACS_TIME *end_time; |
2484 { | 2562 { |
2485 volatile Lisp_Object c; | 2563 volatile Lisp_Object c; |
2486 int count; | 2564 int count, jmpcount; |
2487 jmp_buf local_getcjmp; | 2565 jmp_buf local_getcjmp; |
2488 jmp_buf save_jump; | 2566 jmp_buf save_jump; |
2489 volatile int key_already_recorded = 0; | 2567 volatile int key_already_recorded = 0; |
2490 Lisp_Object tem, save; | 2568 Lisp_Object tem, save; |
2491 volatile Lisp_Object previous_echo_area_message; | 2569 volatile Lisp_Object previous_echo_area_message; |
2712 We will do that below, temporarily for short sections of code, | 2790 We will do that below, temporarily for short sections of code, |
2713 when appropriate. local_getcjmp must be in effect | 2791 when appropriate. local_getcjmp must be in effect |
2714 around any call to sit_for or kbd_buffer_get_event; | 2792 around any call to sit_for or kbd_buffer_get_event; |
2715 it *must not* be in effect when we call redisplay. */ | 2793 it *must not* be in effect when we call redisplay. */ |
2716 | 2794 |
2795 jmpcount = SPECPDL_INDEX (); | |
2717 if (_setjmp (local_getcjmp)) | 2796 if (_setjmp (local_getcjmp)) |
2718 { | 2797 { |
2719 /* Handle quits while reading the keyboard. */ | 2798 /* Handle quits while reading the keyboard. */ |
2720 /* We must have saved the outer value of getcjmp here, | 2799 /* We must have saved the outer value of getcjmp here, |
2721 so restore it now. */ | 2800 so restore it now. */ |
2722 restore_getcjmp (save_jump); | 2801 restore_getcjmp (save_jump); |
2802 unbind_to (jmpcount, Qnil); | |
2723 XSETINT (c, quit_char); | 2803 XSETINT (c, quit_char); |
2724 internal_last_event_frame = selected_frame; | 2804 internal_last_event_frame = selected_frame; |
2725 Vlast_event_frame = internal_last_event_frame; | 2805 Vlast_event_frame = internal_last_event_frame; |
2726 /* If we report the quit char as an event, | 2806 /* If we report the quit char as an event, |
2727 don't do so more than once. */ | 2807 don't do so more than once. */ |
2758 } | 2838 } |
2759 #endif | 2839 #endif |
2760 goto non_reread; | 2840 goto non_reread; |
2761 } | 2841 } |
2762 | 2842 |
2763 timer_start_idle (); | 2843 /* Start idle timers if no time limit is supplied. We don't do it |
2844 if a time limit is supplied to avoid an infinite recursion in the | |
2845 situation where an idle timer calls `sit-for'. */ | |
2846 | |
2847 if (!end_time) | |
2848 timer_start_idle (); | |
2764 | 2849 |
2765 /* If in middle of key sequence and minibuffer not active, | 2850 /* If in middle of key sequence and minibuffer not active, |
2766 start echoing if enough time elapses. */ | 2851 start echoing if enough time elapses. */ |
2767 | 2852 |
2768 if (minibuf_level == 0 | 2853 if (minibuf_level == 0 |
2828 && unread_command_char < 0) | 2913 && unread_command_char < 0) |
2829 { | 2914 { |
2830 c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); | 2915 c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); |
2831 | 2916 |
2832 /* Now that we have read an event, Emacs is not idle. */ | 2917 /* Now that we have read an event, Emacs is not idle. */ |
2833 timer_stop_idle (); | 2918 if (!end_time) |
2919 timer_stop_idle (); | |
2834 | 2920 |
2835 goto exit; | 2921 goto exit; |
2836 } | 2922 } |
2837 | 2923 |
2838 /* Maybe autosave and/or garbage collect due to idleness. */ | 2924 /* Maybe autosave and/or garbage collect due to idleness. */ |
2971 } | 3057 } |
2972 | 3058 |
2973 /* Actually read a character, waiting if necessary. */ | 3059 /* Actually read a character, waiting if necessary. */ |
2974 save_getcjmp (save_jump); | 3060 save_getcjmp (save_jump); |
2975 restore_getcjmp (local_getcjmp); | 3061 restore_getcjmp (local_getcjmp); |
2976 timer_start_idle (); | 3062 if (!end_time) |
3063 timer_start_idle (); | |
2977 c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); | 3064 c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time); |
2978 restore_getcjmp (save_jump); | 3065 restore_getcjmp (save_jump); |
2979 | 3066 |
2980 #ifdef MULTI_KBOARD | 3067 #ifdef MULTI_KBOARD |
2981 if (! NILP (c) && (kb != current_kboard)) | 3068 if (! NILP (c) && (kb != current_kboard)) |
3023 XSETINT (c, XINT (c) | (extra_keyboard_modifiers & ~0xff7f & ~CHAR_CTL)); | 3110 XSETINT (c, XINT (c) | (extra_keyboard_modifiers & ~0xff7f & ~CHAR_CTL)); |
3024 } | 3111 } |
3025 | 3112 |
3026 non_reread: | 3113 non_reread: |
3027 | 3114 |
3028 timer_stop_idle (); | 3115 if (!end_time) |
3116 timer_stop_idle (); | |
3029 RESUME_POLLING; | 3117 RESUME_POLLING; |
3030 | 3118 |
3031 if (NILP (c)) | 3119 if (NILP (c)) |
3032 { | 3120 { |
3033 if (commandflag >= 0 | 3121 if (commandflag >= 0 |
3061 #endif | 3149 #endif |
3062 | 3150 |
3063 last_input_char = c; | 3151 last_input_char = c; |
3064 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); | 3152 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_char), Qt); |
3065 | 3153 |
3066 if (CONSP (c) && EQ (XCAR (c), Qselect_window)) | 3154 if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) |
3067 /* We stopped being idle for this event; undo that. This | 3155 /* We stopped being idle for this event; undo that. This |
3068 prevents automatic window selection (under | 3156 prevents automatic window selection (under |
3069 mouse_autoselect_window from acting as a real input event, for | 3157 mouse_autoselect_window from acting as a real input event, for |
3070 example banishing the mouse under mouse-avoidance-mode. */ | 3158 example banishing the mouse under mouse-avoidance-mode. */ |
3071 timer_resume_idle (); | 3159 timer_resume_idle (); |
3270 position = Fcar (tem); | 3358 position = Fcar (tem); |
3271 | 3359 |
3272 show_help_echo (help, window, object, position, 0); | 3360 show_help_echo (help, window, object, position, 0); |
3273 | 3361 |
3274 /* We stopped being idle for this event; undo that. */ | 3362 /* We stopped being idle for this event; undo that. */ |
3275 timer_resume_idle (); | 3363 if (!end_time) |
3364 timer_resume_idle (); | |
3276 goto retry; | 3365 goto retry; |
3277 } | 3366 } |
3278 | 3367 |
3279 if (! reread || this_command_key_count == 0 | 3368 if (! reread || this_command_key_count == 0 |
3280 || this_command_key_count_reset) | 3369 || this_command_key_count_reset) |
3554 jmp_buf temp; | 3643 jmp_buf temp; |
3555 { | 3644 { |
3556 bcopy (temp, getcjmp, sizeof getcjmp); | 3645 bcopy (temp, getcjmp, sizeof getcjmp); |
3557 } | 3646 } |
3558 | 3647 |
3559 #ifdef HAVE_MOUSE | |
3560 | |
3561 /* Restore mouse tracking enablement. See Ftrack_mouse for the only use | |
3562 of this function. */ | |
3563 | |
3564 static Lisp_Object | |
3565 tracking_off (old_value) | |
3566 Lisp_Object old_value; | |
3567 { | |
3568 do_mouse_tracking = old_value; | |
3569 if (NILP (old_value)) | |
3570 { | |
3571 /* Redisplay may have been preempted because there was input | |
3572 available, and it assumes it will be called again after the | |
3573 input has been processed. If the only input available was | |
3574 the sort that we have just disabled, then we need to call | |
3575 redisplay. */ | |
3576 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) | |
3577 { | |
3578 redisplay_preserve_echo_area (6); | |
3579 get_input_pending (&input_pending, | |
3580 READABLE_EVENTS_DO_TIMERS_NOW); | |
3581 } | |
3582 } | |
3583 return Qnil; | |
3584 } | |
3585 | |
3586 DEFUN ("track-mouse", Ftrack_mouse, Strack_mouse, 0, UNEVALLED, 0, | |
3587 doc: /* Evaluate BODY with mouse movement events enabled. | |
3588 Within a `track-mouse' form, mouse motion generates input events that | |
3589 you can read with `read-event'. | |
3590 Normally, mouse motion is ignored. | |
3591 usage: (track-mouse BODY ...) */) | |
3592 (args) | |
3593 Lisp_Object args; | |
3594 { | |
3595 int count = SPECPDL_INDEX (); | |
3596 Lisp_Object val; | |
3597 | |
3598 record_unwind_protect (tracking_off, do_mouse_tracking); | |
3599 | |
3600 do_mouse_tracking = Qt; | |
3601 | |
3602 val = Fprogn (args); | |
3603 return unbind_to (count, val); | |
3604 } | |
3605 | |
3606 /* If mouse has moved on some frame, return one of those frames. | |
3607 Return 0 otherwise. */ | |
3608 | |
3609 static FRAME_PTR | |
3610 some_mouse_moved () | |
3611 { | |
3612 Lisp_Object tail, frame; | |
3613 | |
3614 FOR_EACH_FRAME (tail, frame) | |
3615 { | |
3616 if (XFRAME (frame)->mouse_moved) | |
3617 return XFRAME (frame); | |
3618 } | |
3619 | |
3620 return 0; | |
3621 } | |
3622 | |
3623 #endif /* HAVE_MOUSE */ | |
3624 | |
3625 /* Low level keyboard/mouse input. | 3648 /* Low level keyboard/mouse input. |
3626 kbd_buffer_store_event places events in kbd_buffer, and | 3649 kbd_buffer_store_event places events in kbd_buffer, and |
3627 kbd_buffer_get_event retrieves them. */ | 3650 kbd_buffer_get_event retrieves them. */ |
3628 | 3651 |
3629 /* Return true iff there are any events in the queue that read-char | 3652 /* Return true iff there are any events in the queue that read-char |
4054 #endif | 4077 #endif |
4055 if (end_time) | 4078 if (end_time) |
4056 { | 4079 { |
4057 EMACS_TIME duration; | 4080 EMACS_TIME duration; |
4058 EMACS_GET_TIME (duration); | 4081 EMACS_GET_TIME (duration); |
4059 EMACS_SUB_TIME (duration, *end_time, duration); | 4082 if (EMACS_TIME_GE (duration, *end_time)) |
4060 if (EMACS_TIME_NEG_P (duration)) | 4083 return Qnil; /* finished waiting */ |
4061 return Qnil; | |
4062 else | 4084 else |
4063 wait_reading_process_output (EMACS_SECS (duration), | 4085 { |
4064 EMACS_USECS (duration), | 4086 EMACS_SUB_TIME (duration, *end_time, duration); |
4065 -1, 1, Qnil, NULL, 0); | 4087 wait_reading_process_output (EMACS_SECS (duration), |
4088 EMACS_USECS (duration), | |
4089 -1, 1, Qnil, NULL, 0); | |
4090 } | |
4066 } | 4091 } |
4067 else | 4092 else |
4068 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); | 4093 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); |
4069 | 4094 |
4070 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) | 4095 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) |
4632 | 4657 |
4633 /* No timers are pending in the future. */ | 4658 /* No timers are pending in the future. */ |
4634 /* Return 0 if we generated an event, and -1 if not. */ | 4659 /* Return 0 if we generated an event, and -1 if not. */ |
4635 UNGCPRO; | 4660 UNGCPRO; |
4636 return nexttime; | 4661 return nexttime; |
4662 } | |
4663 | |
4664 DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0, | |
4665 doc: /* Return the current length of Emacs idleness. | |
4666 The value is returned as a list of three integers. The first has the | |
4667 most significant 16 bits of the seconds, while the second has the | |
4668 least significant 16 bits. The third integer gives the microsecond | |
4669 count. | |
4670 | |
4671 The microsecond count is zero on systems that do not provide | |
4672 resolution finer than a second. */) | |
4673 () | |
4674 { | |
4675 if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) | |
4676 { | |
4677 EMACS_TIME now, idleness_now; | |
4678 | |
4679 EMACS_GET_TIME (now); | |
4680 EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time); | |
4681 | |
4682 return list3 (make_number ((EMACS_SECS (idleness_now) >> 16) & 0xffff), | |
4683 make_number ((EMACS_SECS (idleness_now) >> 0) & 0xffff), | |
4684 make_number (EMACS_USECS (idleness_now))); | |
4685 } | |
4686 | |
4687 return Qnil; | |
4637 } | 4688 } |
4638 | 4689 |
4639 /* Caches for modify_event_symbol. */ | 4690 /* Caches for modify_event_symbol. */ |
4640 static Lisp_Object accent_key_syms; | 4691 static Lisp_Object accent_key_syms; |
4641 static Lisp_Object func_key_syms; | 4692 static Lisp_Object func_key_syms; |
8563 | 8614 |
8564 /* Structure used to keep track of partial application of key remapping | 8615 /* Structure used to keep track of partial application of key remapping |
8565 such as Vfunction_key_map and Vkey_translation_map. */ | 8616 such as Vfunction_key_map and Vkey_translation_map. */ |
8566 typedef struct keyremap | 8617 typedef struct keyremap |
8567 { | 8618 { |
8568 Lisp_Object map, parent; | 8619 /* This is the map originally specified for this use. */ |
8620 Lisp_Object parent; | |
8621 /* This is a submap reached by looking up, in PARENT, | |
8622 the events from START to END. */ | |
8623 Lisp_Object map; | |
8624 /* Positions [START, END) in the key sequence buffer | |
8625 are the key that we have scanned so far. | |
8626 Those events are the ones that we will replace | |
8627 if PAREHT maps them into a key sequence. */ | |
8569 int start, end; | 8628 int start, end; |
8570 } keyremap; | 8629 } keyremap; |
8571 | 8630 |
8572 /* Lookup KEY in MAP. | 8631 /* Lookup KEY in MAP. |
8573 MAP is a keymap mapping keys to key vectors or functions. | 8632 MAP is a keymap mapping keys to key vectors or functions. |
8636 int input, doit, *diff, bufsize; | 8695 int input, doit, *diff, bufsize; |
8637 { | 8696 { |
8638 Lisp_Object next, key; | 8697 Lisp_Object next, key; |
8639 | 8698 |
8640 key = keybuf[fkey->end++]; | 8699 key = keybuf[fkey->end++]; |
8641 next = access_keymap_keyremap (fkey->map, key, prompt, doit); | 8700 |
8701 if (KEYMAPP (fkey->parent)) | |
8702 next = access_keymap_keyremap (fkey->map, key, prompt, doit); | |
8703 else | |
8704 next = Qnil; | |
8642 | 8705 |
8643 /* If keybuf[fkey->start..fkey->end] is bound in the | 8706 /* If keybuf[fkey->start..fkey->end] is bound in the |
8644 map and we're in a position to do the key remapping, replace it with | 8707 map and we're in a position to do the key remapping, replace it with |
8645 the binding and restart with fkey->start at the end. */ | 8708 the binding and restart with fkey->start at the end. */ |
8646 if ((VECTORP (next) || STRINGP (next)) && doit) | 8709 if ((VECTORP (next) || STRINGP (next)) && doit) |
8876 | 8939 |
8877 /* We may switch keyboards between rescans, so we need to | 8940 /* We may switch keyboards between rescans, so we need to |
8878 reinitialize fkey and keytran before each replay. */ | 8941 reinitialize fkey and keytran before each replay. */ |
8879 fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; | 8942 fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; |
8880 keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map; | 8943 keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map; |
8881 /* If there is no translation map, turn off scanning. */ | 8944 fkey.start = fkey.end = 0; |
8882 fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; | 8945 keytran.start = keytran.end = 0; |
8883 keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; | |
8884 | 8946 |
8885 starting_buffer = current_buffer; | 8947 starting_buffer = current_buffer; |
8886 first_unbound = bufsize + 1; | 8948 first_unbound = bufsize + 1; |
8887 | 8949 |
8888 /* Build our list of keymaps. | 8950 /* Build our list of keymaps. |
9685 new_key = apply_modifiers (modifiers, | 9747 new_key = apply_modifiers (modifiers, |
9686 XCAR (breakdown)); | 9748 XCAR (breakdown)); |
9687 | 9749 |
9688 keybuf[t - 1] = new_key; | 9750 keybuf[t - 1] = new_key; |
9689 mock_input = max (t, mock_input); | 9751 mock_input = max (t, mock_input); |
9690 fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; | 9752 fkey.start = fkey.end = 0; |
9691 keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; | 9753 keytran.start = keytran.end = 0; |
9692 | 9754 |
9693 goto replay_sequence; | 9755 goto replay_sequence; |
9694 } | 9756 } |
9695 } | 9757 } |
9696 } | 9758 } |
11492 staticpro (&menu_bar_one_keymap_changed_items); | 11554 staticpro (&menu_bar_one_keymap_changed_items); |
11493 | 11555 |
11494 menu_bar_items_vector = Qnil; | 11556 menu_bar_items_vector = Qnil; |
11495 staticpro (&menu_bar_items_vector); | 11557 staticpro (&menu_bar_items_vector); |
11496 | 11558 |
11559 defsubr (&Scurrent_idle_time); | |
11497 defsubr (&Sevent_convert_list); | 11560 defsubr (&Sevent_convert_list); |
11498 defsubr (&Sread_key_sequence); | 11561 defsubr (&Sread_key_sequence); |
11499 defsubr (&Sread_key_sequence_vector); | 11562 defsubr (&Sread_key_sequence_vector); |
11500 defsubr (&Srecursive_edit); | 11563 defsubr (&Srecursive_edit); |
11501 #ifdef HAVE_MOUSE | 11564 #ifdef HAVE_MOUSE |
11553 DEFVAR_INT ("unread-command-char", &unread_command_char, | 11616 DEFVAR_INT ("unread-command-char", &unread_command_char, |
11554 doc: /* If not -1, an object to be read as next command input event. */); | 11617 doc: /* If not -1, an object to be read as next command input event. */); |
11555 | 11618 |
11556 DEFVAR_LISP ("unread-post-input-method-events", &Vunread_post_input_method_events, | 11619 DEFVAR_LISP ("unread-post-input-method-events", &Vunread_post_input_method_events, |
11557 doc: /* List of events to be processed as input by input methods. | 11620 doc: /* List of events to be processed as input by input methods. |
11558 These events are processed after `unread-command-events', but | 11621 These events are processed before `unread-command-events' |
11559 before actual keyboard input. */); | 11622 and actual keyboard input without given to `input-method-function'. */); |
11560 Vunread_post_input_method_events = Qnil; | 11623 Vunread_post_input_method_events = Qnil; |
11561 | 11624 |
11562 DEFVAR_LISP ("unread-input-method-events", &Vunread_input_method_events, | 11625 DEFVAR_LISP ("unread-input-method-events", &Vunread_input_method_events, |
11563 doc: /* List of events to be processed as input by input methods. | 11626 doc: /* List of events to be processed as input by input methods. |
11564 These events are processed after `unread-command-events', but | 11627 These events are processed after `unread-command-events', but |
11565 before actual keyboard input. */); | 11628 before actual keyboard input. |
11629 If there's an active input method, the events are given to | |
11630 `input-method-function'. */); | |
11566 Vunread_input_method_events = Qnil; | 11631 Vunread_input_method_events = Qnil; |
11567 | 11632 |
11568 DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char, | 11633 DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char, |
11569 doc: /* Meta-prefix character code. | 11634 doc: /* Meta-prefix character code. |
11570 Meta-foo as command input turns into this character followed by foo. */); | 11635 Meta-foo as command input turns into this character followed by foo. */); |