Mercurial > emacs
comparison src/keyboard.c @ 3452:3393f6e53d25
(read_key_sequence) [!USE_TEXT_PROPERTIES]: Fix typo.
(menu_bar_items) [!USE_TEXT_PROPERTIES]: Likewise.
(kbd_buffer_get_event):
Shorten the first MULTI_FRAME conditional.
(lispy_function_keys): Add `remove' key.
(read_key_sequence): Take out previous change.
If we changed buffers during read_char, go to replay_sequence.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 03 Jun 1993 17:46:38 +0000 |
parents | 4a10e4c34b11 |
children | 1fd89e975a78 |
comparison
equal
deleted
inserted
replaced
3451:93757a9629cc | 3452:3393f6e53d25 |
---|---|
1872 a window system. */ | 1872 a window system. */ |
1873 abort (); | 1873 abort (); |
1874 #endif | 1874 #endif |
1875 } | 1875 } |
1876 | 1876 |
1877 #ifdef MULTI_FRAME | |
1878 /* If this event is on a different frame, return a switch-frame this | 1877 /* If this event is on a different frame, return a switch-frame this |
1879 time, and leave the event in the queue for next time. */ | 1878 time, and leave the event in the queue for next time. */ |
1880 else | 1879 else |
1881 { | 1880 { |
1881 #ifdef MULTI_FRAME | |
1882 Lisp_Object frame = event->frame_or_window; | 1882 Lisp_Object frame = event->frame_or_window; |
1883 Lisp_Object focus; | 1883 Lisp_Object focus; |
1884 | 1884 |
1885 if (XTYPE (frame) == Lisp_Window) | 1885 if (XTYPE (frame) == Lisp_Window) |
1886 frame = WINDOW_FRAME (XWINDOW (frame)); | 1886 frame = WINDOW_FRAME (XWINDOW (frame)); |
1891 | 1891 |
1892 if (! EQ (frame, internal_last_event_frame) | 1892 if (! EQ (frame, internal_last_event_frame) |
1893 && XFRAME (frame) != selected_frame) | 1893 && XFRAME (frame) != selected_frame) |
1894 obj = make_lispy_switch_frame (frame); | 1894 obj = make_lispy_switch_frame (frame); |
1895 internal_last_event_frame = frame; | 1895 internal_last_event_frame = frame; |
1896 #endif /* MULTI_FRAME */ | |
1896 | 1897 |
1897 /* If we didn't decide to make a switch-frame event, go ahead | 1898 /* If we didn't decide to make a switch-frame event, go ahead |
1898 and build a real event from the queue entry. */ | 1899 and build a real event from the queue entry. */ |
1899 | 1900 |
1900 if (NILP (obj)) | 1901 if (NILP (obj)) |
1907 = Qnil); | 1908 = Qnil); |
1908 | 1909 |
1909 kbd_fetch_ptr = event + 1; | 1910 kbd_fetch_ptr = event + 1; |
1910 } | 1911 } |
1911 } | 1912 } |
1912 #endif | |
1913 } | 1913 } |
1914 else if (do_mouse_tracking && mouse_moved) | 1914 else if (do_mouse_tracking && mouse_moved) |
1915 { | 1915 { |
1916 FRAME_PTR f; | 1916 FRAME_PTR f; |
1917 Lisp_Object bar_window; | 1917 Lisp_Object bar_window; |
2022 indexed by X Windows keysym values. */ | 2022 indexed by X Windows keysym values. */ |
2023 static char *lispy_function_keys[] = | 2023 static char *lispy_function_keys[] = |
2024 { | 2024 { |
2025 /* X Keysym value */ | 2025 /* X Keysym value */ |
2026 | 2026 |
2027 0, 0, 0, 0, 0, 0, 0, 0, /* 0xff00 */ | 2027 "remove", 0, 0, 0, 0, 0, 0, 0, /* 0xff00 */ |
2028 "backspace", | 2028 "backspace", |
2029 "tab", | 2029 "tab", |
2030 "linefeed", | 2030 "linefeed", |
2031 "clear", | 2031 "clear", |
2032 0, | 2032 0, |
3095 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); | 3095 maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); |
3096 bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0])); | 3096 bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0])); |
3097 #ifdef USE_TEXT_PROPERTIES | 3097 #ifdef USE_TEXT_PROPERTIES |
3098 maps[nmaps-2] = get_local_map (PT, current_buffer); | 3098 maps[nmaps-2] = get_local_map (PT, current_buffer); |
3099 #else | 3099 #else |
3100 maps[nmaps-2] = current_buffer->local_map; | 3100 maps[nmaps-2] = current_buffer->keymap; |
3101 #endif | 3101 #endif |
3102 maps[nmaps-1] = global_map; | 3102 maps[nmaps-1] = global_map; |
3103 } | 3103 } |
3104 | 3104 |
3105 /* Look up in each map the dummy prefix key `menu-bar'. */ | 3105 /* Look up in each map the dummy prefix key `menu-bar'. */ |
3630 we will need to restore them if we replay a key sequence. */ | 3630 we will need to restore them if we replay a key sequence. */ |
3631 if (INTERACTIVE) | 3631 if (INTERACTIVE) |
3632 echo_start = echo_length (); | 3632 echo_start = echo_length (); |
3633 keys_start = this_command_key_count; | 3633 keys_start = this_command_key_count; |
3634 | 3634 |
3635 #if 0 /* This doesn't quite work, because some of the things | |
3636 that read_char does cannot safely be bypassed. | |
3637 It seems too risky to try to make this work right. */ | |
3635 /* Read the first char of the sequence specially, before setting | 3638 /* Read the first char of the sequence specially, before setting |
3636 up any keymaps, in case a filter runs and switches buffers on us. */ | 3639 up any keymaps, in case a filter runs and switches buffers on us. */ |
3637 first_event = read_char (!prompt, 0, submaps, last_nonmenu_event, | 3640 first_event = read_char (!prompt, 0, submaps, last_nonmenu_event, |
3638 &junk); | 3641 &junk); |
3642 #endif | |
3639 | 3643 |
3640 /* We jump here when the key sequence has been thoroughly changed, and | 3644 /* We jump here when the key sequence has been thoroughly changed, and |
3641 we need to rescan it starting from the beginning. When we jump here, | 3645 we need to rescan it starting from the beginning. When we jump here, |
3642 keybuf[0..mock_input] holds the sequence we should reread. */ | 3646 keybuf[0..mock_input] holds the sequence we should reread. */ |
3643 replay_sequence: | 3647 replay_sequence: |
3659 } | 3663 } |
3660 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); | 3664 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); |
3661 #ifdef USE_TEXT_PROPERTIES | 3665 #ifdef USE_TEXT_PROPERTIES |
3662 submaps[nmaps-2] = get_local_map (PT, current_buffer); | 3666 submaps[nmaps-2] = get_local_map (PT, current_buffer); |
3663 #else | 3667 #else |
3664 submaps[nmaps-2] = current_buffer->local_map; | 3668 submaps[nmaps-2] = current_buffer->keymap; |
3665 #endif | 3669 #endif |
3666 submaps[nmaps-1] = global_map; | 3670 submaps[nmaps-1] = global_map; |
3667 } | 3671 } |
3668 | 3672 |
3669 /* Find an accurate initial value for first_binding. */ | 3673 /* Find an accurate initial value for first_binding. */ |
3731 } | 3735 } |
3732 | 3736 |
3733 /* If not, we should actually read a character. */ | 3737 /* If not, we should actually read a character. */ |
3734 else | 3738 else |
3735 { | 3739 { |
3740 struct buffer *buf = current_buffer; | |
3741 | |
3736 last_real_key_start = t; | 3742 last_real_key_start = t; |
3737 | 3743 |
3738 if (! NILP (first_event)) | 3744 key = read_char (!prompt, nmaps, submaps, last_nonmenu_event, |
3739 { | 3745 &used_mouse_menu); |
3740 key = first_event; | |
3741 first_event = Qnil; | |
3742 } | |
3743 else | |
3744 key = read_char (!prompt, nmaps, submaps, last_nonmenu_event, | |
3745 &used_mouse_menu); | |
3746 | 3746 |
3747 /* read_char returns -1 at the end of a macro. | 3747 /* read_char returns -1 at the end of a macro. |
3748 Emacs 18 handles this by returning immediately with a | 3748 Emacs 18 handles this by returning immediately with a |
3749 zero, so that's what we'll do. */ | 3749 zero, so that's what we'll do. */ |
3750 if (XTYPE (key) == Lisp_Int && XINT (key) == -1) | 3750 if (XTYPE (key) == Lisp_Int && XINT (key) == -1) |
3816 error ("key sequence too long"); | 3816 error ("key sequence too long"); |
3817 keybuf[t] = posn; | 3817 keybuf[t] = posn; |
3818 keybuf[t+1] = key; | 3818 keybuf[t+1] = key; |
3819 mock_input = t + 2; | 3819 mock_input = t + 2; |
3820 | 3820 |
3821 /* If we switched buffers while reading the first event, | |
3822 replay in case we switched keymaps too. */ | |
3823 if (buf != current_buffer && t == 0) | |
3824 goto replay_sequence; | |
3821 goto replay_key; | 3825 goto replay_key; |
3822 } | 3826 } |
3823 } | 3827 } |
3824 else if (EQ (kind, Qswitch_frame)) | 3828 else if (EQ (kind, Qswitch_frame)) |
3825 { | 3829 { |
3852 keybuf[t+1] = key; | 3856 keybuf[t+1] = key; |
3853 mock_input = t + 2; | 3857 mock_input = t + 2; |
3854 goto replay_sequence; | 3858 goto replay_sequence; |
3855 } | 3859 } |
3856 } | 3860 } |
3861 } | |
3862 | |
3863 /* If we switched buffers while reading the first event, | |
3864 replay in case we switched keymaps too. */ | |
3865 if (buf != current_buffer && t == 0) | |
3866 { | |
3867 keybuf[t++] = key; | |
3868 mock_input = t; | |
3869 goto replay_sequence; | |
3857 } | 3870 } |
3858 } | 3871 } |
3859 | 3872 |
3860 /* We have finally decided that KEY is something we might want | 3873 /* We have finally decided that KEY is something we might want |
3861 to look up. */ | 3874 to look up. */ |