aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c244
1 files changed, 124 insertions, 120 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 78aa1cfea77..63e7573fbe9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -451,7 +451,7 @@ static int store_user_signal_events (void);
451 C can be a character, which is printed prettily ("M-C-x" and all that 451 C can be a character, which is printed prettily ("M-C-x" and all that
452 jazz), or a symbol, whose name is printed. */ 452 jazz), or a symbol, whose name is printed. */
453 453
454void 454static void
455echo_char (Lisp_Object c) 455echo_char (Lisp_Object c)
456{ 456{
457 if (current_kboard->immediate_echo) 457 if (current_kboard->immediate_echo)
@@ -538,7 +538,7 @@ echo_char (Lisp_Object c)
538/* Temporarily add a dash to the end of the echo string if it's not 538/* Temporarily add a dash to the end of the echo string if it's not
539 empty, so that it serves as a mini-prompt for the very next character. */ 539 empty, so that it serves as a mini-prompt for the very next character. */
540 540
541void 541static void
542echo_dash (void) 542echo_dash (void)
543{ 543{
544 /* Do nothing if not echoing at all. */ 544 /* Do nothing if not echoing at all. */
@@ -967,7 +967,7 @@ restore_kboard_configuration (Lisp_Object was_locked)
967/* Handle errors that are not handled at inner levels 967/* Handle errors that are not handled at inner levels
968 by printing an error message and returning to the editor command loop. */ 968 by printing an error message and returning to the editor command loop. */
969 969
970Lisp_Object 970static Lisp_Object
971cmd_error (Lisp_Object data) 971cmd_error (Lisp_Object data)
972{ 972{
973 Lisp_Object old_level, old_length; 973 Lisp_Object old_level, old_length;
@@ -1132,7 +1132,7 @@ command_loop_2 (Lisp_Object ignore)
1132 return Qnil; 1132 return Qnil;
1133} 1133}
1134 1134
1135Lisp_Object 1135static Lisp_Object
1136top_level_2 (void) 1136top_level_2 (void)
1137{ 1137{
1138 return Feval (Vtop_level, Qnil); 1138 return Feval (Vtop_level, Qnil);
@@ -1169,6 +1169,7 @@ This also exits all active minibuffers. */)
1169 Fthrow (Qtop_level, Qnil); 1169 Fthrow (Qtop_level, Qnil);
1170} 1170}
1171 1171
1172Lisp_Object Fexit_recursive_edit (void) NO_RETURN;
1172DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", 1173DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "",
1173 doc: /* Exit from the innermost recursive edit or minibuffer. */) 1174 doc: /* Exit from the innermost recursive edit or minibuffer. */)
1174 (void) 1175 (void)
@@ -1179,6 +1180,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0,
1179 error ("No recursive edit is in progress"); 1180 error ("No recursive edit is in progress");
1180} 1181}
1181 1182
1183Lisp_Object Fabort_recursive_edit (void) NO_RETURN;
1182DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", 1184DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "",
1183 doc: /* Abort the command that requested this recursive edit or minibuffer input. */) 1185 doc: /* Abort the command that requested this recursive edit or minibuffer input. */)
1184 (void) 1186 (void)
@@ -1885,7 +1887,7 @@ poll_for_input_1 (void)
1885/* Timer callback function for poll_timer. TIMER is equal to 1887/* Timer callback function for poll_timer. TIMER is equal to
1886 poll_timer. */ 1888 poll_timer. */
1887 1889
1888void 1890static void
1889poll_for_input (struct atimer *timer) 1891poll_for_input (struct atimer *timer)
1890{ 1892{
1891 if (poll_suppress_count == 0) 1893 if (poll_suppress_count == 0)
@@ -2184,7 +2186,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2184 int *used_mouse_menu, struct timeval *end_time) 2186 int *used_mouse_menu, struct timeval *end_time)
2185{ 2187{
2186 volatile Lisp_Object c; 2188 volatile Lisp_Object c;
2187 int count, jmpcount; 2189 int jmpcount;
2188 jmp_buf local_getcjmp; 2190 jmp_buf local_getcjmp;
2189 jmp_buf save_jump; 2191 jmp_buf save_jump;
2190 volatile int key_already_recorded = 0; 2192 volatile int key_already_recorded = 0;
@@ -2461,21 +2463,21 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2461 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); 2463 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame));
2462 if (kb != current_kboard) 2464 if (kb != current_kboard)
2463 { 2465 {
2464 Lisp_Object link = KVAR (kb, kbd_queue); 2466 Lisp_Object last = KVAR (kb, kbd_queue);
2465 /* We shouldn't get here if we were in single-kboard mode! */ 2467 /* We shouldn't get here if we were in single-kboard mode! */
2466 if (single_kboard) 2468 if (single_kboard)
2467 abort (); 2469 abort ();
2468 if (CONSP (link)) 2470 if (CONSP (last))
2469 { 2471 {
2470 while (CONSP (XCDR (link))) 2472 while (CONSP (XCDR (last)))
2471 link = XCDR (link); 2473 last = XCDR (last);
2472 if (!NILP (XCDR (link))) 2474 if (!NILP (XCDR (last)))
2473 abort (); 2475 abort ();
2474 } 2476 }
2475 if (!CONSP (link)) 2477 if (!CONSP (last))
2476 KVAR (kb, kbd_queue) = Fcons (c, Qnil); 2478 KVAR (kb, kbd_queue) = Fcons (c, Qnil);
2477 else 2479 else
2478 XSETCDR (link, Fcons (c, Qnil)); 2480 XSETCDR (last, Fcons (c, Qnil));
2479 kb->kbd_queue_has_data = 1; 2481 kb->kbd_queue_has_data = 1;
2480 current_kboard = kb; 2482 current_kboard = kb;
2481 /* This is going to exit from read_char 2483 /* This is going to exit from read_char
@@ -2692,7 +2694,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2692 2694
2693 if (NILP (c)) 2695 if (NILP (c))
2694 { 2696 {
2695 KBOARD *kb; 2697 KBOARD *kb IF_LINT (= NULL);
2696 2698
2697 if (end_time) 2699 if (end_time)
2698 { 2700 {
@@ -2712,18 +2714,18 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2712 2714
2713 if (! NILP (c) && (kb != current_kboard)) 2715 if (! NILP (c) && (kb != current_kboard))
2714 { 2716 {
2715 Lisp_Object link = KVAR (kb, kbd_queue); 2717 Lisp_Object last = KVAR (kb, kbd_queue);
2716 if (CONSP (link)) 2718 if (CONSP (last))
2717 { 2719 {
2718 while (CONSP (XCDR (link))) 2720 while (CONSP (XCDR (last)))
2719 link = XCDR (link); 2721 last = XCDR (last);
2720 if (!NILP (XCDR (link))) 2722 if (!NILP (XCDR (last)))
2721 abort (); 2723 abort ();
2722 } 2724 }
2723 if (!CONSP (link)) 2725 if (!CONSP (last))
2724 KVAR (kb, kbd_queue) = Fcons (c, Qnil); 2726 KVAR (kb, kbd_queue) = Fcons (c, Qnil);
2725 else 2727 else
2726 XSETCDR (link, Fcons (c, Qnil)); 2728 XSETCDR (last, Fcons (c, Qnil));
2727 kb->kbd_queue_has_data = 1; 2729 kb->kbd_queue_has_data = 1;
2728 c = Qnil; 2730 c = Qnil;
2729 if (single_kboard) 2731 if (single_kboard)
@@ -2912,7 +2914,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2912 { 2914 {
2913 Lisp_Object keys; 2915 Lisp_Object keys;
2914 int key_count, key_count_reset; 2916 int key_count, key_count_reset;
2915 struct gcpro gcpro1; 2917 struct gcpro inner_gcpro1;
2916 int count = SPECPDL_INDEX (); 2918 int count = SPECPDL_INDEX ();
2917 2919
2918 /* Save the echo status. */ 2920 /* Save the echo status. */
@@ -2940,7 +2942,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2940 keys = Fcopy_sequence (this_command_keys); 2942 keys = Fcopy_sequence (this_command_keys);
2941 else 2943 else
2942 keys = Qnil; 2944 keys = Qnil;
2943 GCPRO1 (keys); 2945 GCPRO1_VAR (keys, inner_gcpro);
2944 2946
2945 /* Clear out this_command_keys. */ 2947 /* Clear out this_command_keys. */
2946 this_command_key_count = 0; 2948 this_command_key_count = 0;
@@ -2978,7 +2980,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2978 if (saved_immediate_echo) 2980 if (saved_immediate_echo)
2979 echo_now (); 2981 echo_now ();
2980 2982
2981 UNGCPRO; 2983 UNGCPRO_VAR (inner_gcpro);
2982 2984
2983 /* The input method can return no events. */ 2985 /* The input method can return no events. */
2984 if (! CONSP (tem)) 2986 if (! CONSP (tem))
@@ -3000,16 +3002,16 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
3000 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) 3002 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))
3001 { 3003 {
3002 /* (help-echo FRAME HELP WINDOW OBJECT POS). */ 3004 /* (help-echo FRAME HELP WINDOW OBJECT POS). */
3003 Lisp_Object help, object, position, window, tem; 3005 Lisp_Object help, object, position, window, htem;
3004 3006
3005 tem = Fcdr (XCDR (c)); 3007 htem = Fcdr (XCDR (c));
3006 help = Fcar (tem); 3008 help = Fcar (htem);
3007 tem = Fcdr (tem); 3009 htem = Fcdr (htem);
3008 window = Fcar (tem); 3010 window = Fcar (htem);
3009 tem = Fcdr (tem); 3011 htem = Fcdr (htem);
3010 object = Fcar (tem); 3012 object = Fcar (htem);
3011 tem = Fcdr (tem); 3013 htem = Fcdr (htem);
3012 position = Fcar (tem); 3014 position = Fcar (htem);
3013 3015
3014 show_help_echo (help, window, object, position, 0); 3016 show_help_echo (help, window, object, position, 0);
3015 3017
@@ -3051,7 +3053,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
3051 if (!NILP (Vhelp_form) && help_char_p (c)) 3053 if (!NILP (Vhelp_form) && help_char_p (c))
3052 { 3054 {
3053 Lisp_Object tem0; 3055 Lisp_Object tem0;
3054 count = SPECPDL_INDEX (); 3056 int count = SPECPDL_INDEX ();
3055 3057
3056 help_form_saved_window_configs 3058 help_form_saved_window_configs
3057 = Fcons (Fcurrent_window_configuration (Qnil), 3059 = Fcons (Fcurrent_window_configuration (Qnil),
@@ -4024,7 +4026,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4024 Lisp_Object bar_window; 4026 Lisp_Object bar_window;
4025 enum scroll_bar_part part; 4027 enum scroll_bar_part part;
4026 Lisp_Object x, y; 4028 Lisp_Object x, y;
4027 unsigned long time; 4029 unsigned long t;
4028 4030
4029 *kbp = current_kboard; 4031 *kbp = current_kboard;
4030 /* Note that this uses F to determine which terminal to look at. 4032 /* Note that this uses F to determine which terminal to look at.
@@ -4035,7 +4037,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4035 /* XXX Can f or mouse_position_hook be NULL here? */ 4037 /* XXX Can f or mouse_position_hook be NULL here? */
4036 if (f && FRAME_TERMINAL (f)->mouse_position_hook) 4038 if (f && FRAME_TERMINAL (f)->mouse_position_hook)
4037 (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window, 4039 (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window,
4038 &part, &x, &y, &time); 4040 &part, &x, &y, &t);
4039 4041
4040 obj = Qnil; 4042 obj = Qnil;
4041 4043
@@ -4059,7 +4061,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4059 /* If we didn't decide to make a switch-frame event, go ahead and 4061 /* If we didn't decide to make a switch-frame event, go ahead and
4060 return a mouse-motion event. */ 4062 return a mouse-motion event. */
4061 if (!NILP (x) && NILP (obj)) 4063 if (!NILP (x) && NILP (obj))
4062 obj = make_lispy_movement (f, bar_window, part, x, y, time); 4064 obj = make_lispy_movement (f, bar_window, part, x, y, t);
4063 } 4065 }
4064#endif /* HAVE_MOUSE || HAVE GPM */ 4066#endif /* HAVE_MOUSE || HAVE GPM */
4065 else 4067 else
@@ -5037,7 +5039,7 @@ int double_click_count;
5037 5039
5038static Lisp_Object 5040static Lisp_Object
5039make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, 5041make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5040 unsigned long time) 5042 unsigned long t)
5041{ 5043{
5042 enum window_part part; 5044 enum window_part part;
5043 Lisp_Object posn = Qnil; 5045 Lisp_Object posn = Qnil;
@@ -5218,7 +5220,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5218 Fcons (posn, 5220 Fcons (posn,
5219 Fcons (Fcons (make_number (xret), 5221 Fcons (Fcons (make_number (xret),
5220 make_number (yret)), 5222 make_number (yret)),
5221 Fcons (make_number (time), 5223 Fcons (make_number (t),
5222 extra_info)))); 5224 extra_info))));
5223} 5225}
5224 5226
@@ -5642,19 +5644,19 @@ make_lispy_event (struct input_event *event)
5642 /* On window-system frames, use the value of 5644 /* On window-system frames, use the value of
5643 double-click-fuzz as is. On other frames, interpret it 5645 double-click-fuzz as is. On other frames, interpret it
5644 as a multiple of 1/8 characters. */ 5646 as a multiple of 1/8 characters. */
5645 struct frame *f; 5647 struct frame *fr;
5646 int fuzz; 5648 int fuzz;
5647 int symbol_num; 5649 int symbol_num;
5648 int is_double; 5650 int is_double;
5649 5651
5650 if (WINDOWP (event->frame_or_window)) 5652 if (WINDOWP (event->frame_or_window))
5651 f = XFRAME (XWINDOW (event->frame_or_window)->frame); 5653 fr = XFRAME (XWINDOW (event->frame_or_window)->frame);
5652 else if (FRAMEP (event->frame_or_window)) 5654 else if (FRAMEP (event->frame_or_window))
5653 f = XFRAME (event->frame_or_window); 5655 fr = XFRAME (event->frame_or_window);
5654 else 5656 else
5655 abort (); 5657 abort ();
5656 5658
5657 fuzz = FRAME_WINDOW_P (f) 5659 fuzz = FRAME_WINDOW_P (fr)
5658 ? double_click_fuzz : double_click_fuzz / 8; 5660 ? double_click_fuzz : double_click_fuzz / 8;
5659 5661
5660 if (event->modifiers & up_modifier) 5662 if (event->modifiers & up_modifier)
@@ -5927,7 +5929,7 @@ make_lispy_event (struct input_event *event)
5927 5929
5928static Lisp_Object 5930static Lisp_Object
5929make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, 5931make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part,
5930 Lisp_Object x, Lisp_Object y, unsigned long time) 5932 Lisp_Object x, Lisp_Object y, unsigned long t)
5931{ 5933{
5932 /* Is it a scroll bar movement? */ 5934 /* Is it a scroll bar movement? */
5933 if (frame && ! NILP (bar_window)) 5935 if (frame && ! NILP (bar_window))
@@ -5939,7 +5941,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
5939 Fcons (list5 (bar_window, 5941 Fcons (list5 (bar_window,
5940 Qvertical_scroll_bar, 5942 Qvertical_scroll_bar,
5941 Fcons (x, y), 5943 Fcons (x, y),
5942 make_number (time), 5944 make_number (t),
5943 part_sym), 5945 part_sym),
5944 Qnil)); 5946 Qnil));
5945 } 5947 }
@@ -5947,7 +5949,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
5947 else 5949 else
5948 { 5950 {
5949 Lisp_Object position; 5951 Lisp_Object position;
5950 position = make_lispy_position (frame, x, y, time); 5952 position = make_lispy_position (frame, x, y, t);
5951 return list2 (Qmouse_movement, position); 5953 return list2 (Qmouse_movement, position);
5952 } 5954 }
5953} 5955}
@@ -6236,7 +6238,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers,
6236static Lisp_Object 6238static Lisp_Object
6237apply_modifiers (int modifiers, Lisp_Object base) 6239apply_modifiers (int modifiers, Lisp_Object base)
6238{ 6240{
6239 Lisp_Object cache, index, entry, new_symbol; 6241 Lisp_Object cache, idx, entry, new_symbol;
6240 6242
6241 /* Mask out upper bits. We don't know where this value's been. */ 6243 /* Mask out upper bits. We don't know where this value's been. */
6242 modifiers &= INTMASK; 6244 modifiers &= INTMASK;
@@ -6246,8 +6248,8 @@ apply_modifiers (int modifiers, Lisp_Object base)
6246 6248
6247 /* The click modifier never figures into cache indices. */ 6249 /* The click modifier never figures into cache indices. */
6248 cache = Fget (base, Qmodifier_cache); 6250 cache = Fget (base, Qmodifier_cache);
6249 XSETFASTINT (index, (modifiers & ~click_modifier)); 6251 XSETFASTINT (idx, (modifiers & ~click_modifier));
6250 entry = assq_no_quit (index, cache); 6252 entry = assq_no_quit (idx, cache);
6251 6253
6252 if (CONSP (entry)) 6254 if (CONSP (entry))
6253 new_symbol = XCDR (entry); 6255 new_symbol = XCDR (entry);
@@ -6260,14 +6262,14 @@ apply_modifiers (int modifiers, Lisp_Object base)
6260 SBYTES (SYMBOL_NAME (base))); 6262 SBYTES (SYMBOL_NAME (base)));
6261 6263
6262 /* Add the new symbol to the base's cache. */ 6264 /* Add the new symbol to the base's cache. */
6263 entry = Fcons (index, new_symbol); 6265 entry = Fcons (idx, new_symbol);
6264 Fput (base, Qmodifier_cache, Fcons (entry, cache)); 6266 Fput (base, Qmodifier_cache, Fcons (entry, cache));
6265 6267
6266 /* We have the parsing info now for free, so we could add it to 6268 /* We have the parsing info now for free, so we could add it to
6267 the caches: 6269 the caches:
6268 XSETFASTINT (index, modifiers); 6270 XSETFASTINT (idx, modifiers);
6269 Fput (new_symbol, Qevent_symbol_element_mask, 6271 Fput (new_symbol, Qevent_symbol_element_mask,
6270 Fcons (base, Fcons (index, Qnil))); 6272 Fcons (base, Fcons (idx, Qnil)));
6271 Fput (new_symbol, Qevent_symbol_elements, 6273 Fput (new_symbol, Qevent_symbol_elements,
6272 Fcons (base, lispy_modifier_list (modifiers))); 6274 Fcons (base, lispy_modifier_list (modifiers)));
6273 Sadly, this is only correct if `base' is indeed a base event, 6275 Sadly, this is only correct if `base' is indeed a base event,
@@ -6821,16 +6823,17 @@ decode_keyboard_code (struct tty_display_info *tty,
6821 return; 6823 return;
6822 for (i = 0, p = coding->destination; i < coding->produced_char; i++) 6824 for (i = 0, p = coding->destination; i < coding->produced_char; i++)
6823 { 6825 {
6824 struct input_event buf; 6826 struct input_event event_buf;
6825 6827
6826 EVENT_INIT (buf); 6828 EVENT_INIT (event_buf);
6827 buf.code = STRING_CHAR_ADVANCE (p); 6829 event_buf.code = STRING_CHAR_ADVANCE (p);
6828 buf.kind = (ASCII_CHAR_P (buf.code) 6830 event_buf.kind =
6829 ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); 6831 (ASCII_CHAR_P (event_buf.code)
6832 ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
6830 /* See the comment in tty_read_avail_input. */ 6833 /* See the comment in tty_read_avail_input. */
6831 buf.frame_or_window = tty->top_frame; 6834 event_buf.frame_or_window = tty->top_frame;
6832 buf.arg = Qnil; 6835 event_buf.arg = Qnil;
6833 kbd_buffer_store_event (&buf); 6836 kbd_buffer_store_event (&event_buf);
6834 } 6837 }
6835} 6838}
6836 6839
@@ -6890,11 +6893,11 @@ tty_read_avail_input (struct terminal *terminal,
6890 if (gpm_tty == tty) 6893 if (gpm_tty == tty)
6891 { 6894 {
6892 Gpm_Event event; 6895 Gpm_Event event;
6893 struct input_event hold_quit; 6896 struct input_event gpm_hold_quit;
6894 int gpm, fd = gpm_fd; 6897 int gpm, fd = gpm_fd;
6895 6898
6896 EVENT_INIT (hold_quit); 6899 EVENT_INIT (gpm_hold_quit);
6897 hold_quit.kind = NO_EVENT; 6900 gpm_hold_quit.kind = NO_EVENT;
6898 6901
6899 /* gpm==1 if event received. 6902 /* gpm==1 if event received.
6900 gpm==0 if the GPM daemon has closed the connection, in which case 6903 gpm==0 if the GPM daemon has closed the connection, in which case
@@ -6903,13 +6906,13 @@ tty_read_avail_input (struct terminal *terminal,
6903 select masks. 6906 select masks.
6904 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ 6907 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */
6905 while (gpm = Gpm_GetEvent (&event), gpm == 1) { 6908 while (gpm = Gpm_GetEvent (&event), gpm == 1) {
6906 nread += handle_one_term_event (tty, &event, &hold_quit); 6909 nread += handle_one_term_event (tty, &event, &gpm_hold_quit);
6907 } 6910 }
6908 if (gpm == 0) 6911 if (gpm == 0)
6909 /* Presumably the GPM daemon has closed the connection. */ 6912 /* Presumably the GPM daemon has closed the connection. */
6910 close_gpm (fd); 6913 close_gpm (fd);
6911 if (hold_quit.kind != NO_EVENT) 6914 if (gpm_hold_quit.kind != NO_EVENT)
6912 kbd_buffer_store_event (&hold_quit); 6915 kbd_buffer_store_event (&gpm_hold_quit);
6913 if (nread) 6916 if (nread)
6914 return nread; 6917 return nread;
6915 } 6918 }
@@ -7056,7 +7059,7 @@ tty_read_avail_input (struct terminal *terminal,
7056 return nread; 7059 return nread;
7057} 7060}
7058 7061
7059void 7062static void
7060handle_async_input (void) 7063handle_async_input (void)
7061{ 7064{
7062 interrupt_input_pending = 0; 7065 interrupt_input_pending = 0;
@@ -7329,8 +7332,6 @@ menu_bar_items (Lisp_Object old)
7329 int mapno; 7332 int mapno;
7330 Lisp_Object oquit; 7333 Lisp_Object oquit;
7331 7334
7332 int i;
7333
7334 /* In order to build the menus, we need to call the keymap 7335 /* In order to build the menus, we need to call the keymap
7335 accessors. They all call QUIT. But this function is called 7336 accessors. They all call QUIT. But this function is called
7336 during redisplay, during which a quit is fatal. So inhibit 7337 during redisplay, during which a quit is fatal. So inhibit
@@ -7432,15 +7433,18 @@ menu_bar_items (Lisp_Object old)
7432 } 7433 }
7433 7434
7434 /* Add nil, nil, nil, nil at the end. */ 7435 /* Add nil, nil, nil, nil at the end. */
7435 i = menu_bar_items_index; 7436 {
7436 if (i + 4 > XVECTOR (menu_bar_items_vector)->size) 7437 int i = menu_bar_items_index;
7437 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); 7438 if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
7438 /* Add this item. */ 7439 menu_bar_items_vector =
7439 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7440 larger_vector (menu_bar_items_vector, 2 * i, Qnil);
7440 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7441 /* Add this item. */
7441 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7442 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7442 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7443 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7443 menu_bar_items_index = i; 7444 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7445 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7446 menu_bar_items_index = i;
7447 }
7444 7448
7445 Vinhibit_quit = oquit; 7449 Vinhibit_quit = oquit;
7446 return menu_bar_items_vector; 7450 return menu_bar_items_vector;
@@ -8118,12 +8122,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8118 /* Process the rest of the properties. */ 8122 /* Process the rest of the properties. */
8119 for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item))) 8123 for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item)))
8120 { 8124 {
8121 Lisp_Object key, value; 8125 Lisp_Object ikey, value;
8122 8126
8123 key = XCAR (item); 8127 ikey = XCAR (item);
8124 value = XCAR (XCDR (item)); 8128 value = XCAR (XCDR (item));
8125 8129
8126 if (EQ (key, QCenable)) 8130 if (EQ (ikey, QCenable))
8127 { 8131 {
8128 /* `:enable FORM'. */ 8132 /* `:enable FORM'. */
8129 if (!NILP (Venable_disabled_menus_and_buttons)) 8133 if (!NILP (Venable_disabled_menus_and_buttons))
@@ -8131,20 +8135,20 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8131 else 8135 else
8132 PROP (TOOL_BAR_ITEM_ENABLED_P) = value; 8136 PROP (TOOL_BAR_ITEM_ENABLED_P) = value;
8133 } 8137 }
8134 else if (EQ (key, QCvisible)) 8138 else if (EQ (ikey, QCvisible))
8135 { 8139 {
8136 /* `:visible FORM'. If got a visible property and that 8140 /* `:visible FORM'. If got a visible property and that
8137 evaluates to nil then ignore this item. */ 8141 evaluates to nil then ignore this item. */
8138 if (NILP (menu_item_eval_property (value))) 8142 if (NILP (menu_item_eval_property (value)))
8139 return 0; 8143 return 0;
8140 } 8144 }
8141 else if (EQ (key, QChelp)) 8145 else if (EQ (ikey, QChelp))
8142 /* `:help HELP-STRING'. */ 8146 /* `:help HELP-STRING'. */
8143 PROP (TOOL_BAR_ITEM_HELP) = value; 8147 PROP (TOOL_BAR_ITEM_HELP) = value;
8144 else if (EQ (key, QCvert_only)) 8148 else if (EQ (ikey, QCvert_only))
8145 /* `:vert-only t/nil'. */ 8149 /* `:vert-only t/nil'. */
8146 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; 8150 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
8147 else if (EQ (key, QClabel)) 8151 else if (EQ (ikey, QClabel))
8148 { 8152 {
8149 const char *bad_label = "!!?GARBLED ITEM?!!"; 8153 const char *bad_label = "!!?GARBLED ITEM?!!";
8150 /* `:label LABEL-STRING'. */ 8154 /* `:label LABEL-STRING'. */
@@ -8153,10 +8157,10 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8153 : make_string (bad_label, strlen (bad_label)); 8157 : make_string (bad_label, strlen (bad_label));
8154 have_label = 1; 8158 have_label = 1;
8155 } 8159 }
8156 else if (EQ (key, QCfilter)) 8160 else if (EQ (ikey, QCfilter))
8157 /* ':filter FORM'. */ 8161 /* ':filter FORM'. */
8158 filter = value; 8162 filter = value;
8159 else if (EQ (key, QCbutton) && CONSP (value)) 8163 else if (EQ (ikey, QCbutton) && CONSP (value))
8160 { 8164 {
8161 /* `:button (TYPE . SELECTED)'. */ 8165 /* `:button (TYPE . SELECTED)'. */
8162 Lisp_Object type, selected; 8166 Lisp_Object type, selected;
@@ -8169,13 +8173,13 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8169 PROP (TOOL_BAR_ITEM_TYPE) = type; 8173 PROP (TOOL_BAR_ITEM_TYPE) = type;
8170 } 8174 }
8171 } 8175 }
8172 else if (EQ (key, QCimage) 8176 else if (EQ (ikey, QCimage)
8173 && (CONSP (value) 8177 && (CONSP (value)
8174 || (VECTORP (value) && XVECTOR (value)->size == 4))) 8178 || (VECTORP (value) && XVECTOR (value)->size == 4)))
8175 /* Value is either a single image specification or a vector 8179 /* Value is either a single image specification or a vector
8176 of 4 such specifications for the different button states. */ 8180 of 4 such specifications for the different button states. */
8177 PROP (TOOL_BAR_ITEM_IMAGES) = value; 8181 PROP (TOOL_BAR_ITEM_IMAGES) = value;
8178 else if (EQ (key, Qrtl)) 8182 else if (EQ (ikey, Qrtl))
8179 /* ':rtl STRING' */ 8183 /* ':rtl STRING' */
8180 PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; 8184 PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
8181 } 8185 }
@@ -8184,35 +8188,34 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8184 if (!have_label) 8188 if (!have_label)
8185 { 8189 {
8186 /* Try to make one from caption and key. */ 8190 /* Try to make one from caption and key. */
8187 Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY); 8191 Lisp_Object tkey = PROP (TOOL_BAR_ITEM_KEY);
8188 Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); 8192 Lisp_Object tcapt = PROP (TOOL_BAR_ITEM_CAPTION);
8189 const char *label = SYMBOLP (key) ? SSDATA (SYMBOL_NAME (key)) : ""; 8193 const char *label = SYMBOLP (tkey) ? SSDATA (SYMBOL_NAME (tkey)) : "";
8190 const char *caption = STRINGP (capt) ? SSDATA (capt) : ""; 8194 const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : "";
8191 EMACS_INT max_lbl = 2 * tool_bar_max_label_size; 8195 EMACS_INT max_lbl = 2 * tool_bar_max_label_size;
8192 char *buf = (char *) xmalloc (max_lbl + 1); 8196 char *buf = (char *) xmalloc (max_lbl + 1);
8193 Lisp_Object new_lbl; 8197 Lisp_Object new_lbl;
8194 size_t caption_len = strlen (caption); 8198 size_t caption_len = strlen (capt);
8195 8199
8196 if (caption_len <= max_lbl && caption[0] != '\0') 8200 if (caption_len <= max_lbl && capt[0] != '\0')
8197 { 8201 {
8198 strcpy (buf, caption); 8202 strcpy (buf, capt);
8199 while (caption_len > 0 && buf[caption_len - 1] == '.') 8203 while (caption_len > 0 && buf[caption_len - 1] == '.')
8200 caption_len--; 8204 caption_len--;
8201 buf[caption_len] = '\0'; 8205 buf[caption_len] = '\0';
8202 label = caption = buf; 8206 label = capt = buf;
8203 } 8207 }
8204 8208
8205 if (strlen (label) <= max_lbl && label[0] != '\0') 8209 if (strlen (label) <= max_lbl && label[0] != '\0')
8206 { 8210 {
8207 int i; 8211 int j;
8208 if (label != buf) 8212 if (label != buf)
8209 strcpy (buf, label); 8213 strcpy (buf, label);
8210 8214
8211 for (i = 0; buf[i] != '\0'; ++i) 8215 for (j = 0; buf[j] != '\0'; ++j)
8212 if (buf[i] == '-') 8216 if (buf[j] == '-')
8213 buf[i] = ' '; 8217 buf[j] = ' ';
8214 label = buf; 8218 label = buf;
8215
8216 } 8219 }
8217 else 8220 else
8218 label = ""; 8221 label = "";
@@ -8871,7 +8874,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8871 8874
8872 /* The length of the echo buffer when we started reading, and 8875 /* The length of the echo buffer when we started reading, and
8873 the length of this_command_keys when we started reading. */ 8876 the length of this_command_keys when we started reading. */
8874 int echo_start; 8877 int echo_start IF_LINT (= 0);
8875 int keys_start; 8878 int keys_start;
8876 8879
8877 /* The number of keymaps we're scanning right now, and the number of 8880 /* The number of keymaps we're scanning right now, and the number of
@@ -8949,7 +8952,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8949 Lisp_Object first_event; 8952 Lisp_Object first_event;
8950#endif 8953#endif
8951 8954
8952 Lisp_Object original_uppercase; 8955 Lisp_Object original_uppercase IF_LINT (= Qnil);
8953 int original_uppercase_position = -1; 8956 int original_uppercase_position = -1;
8954 8957
8955 /* Gets around Microsoft compiler limitations. */ 8958 /* Gets around Microsoft compiler limitations. */
@@ -8964,9 +8967,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8964 int junk; 8967 int junk;
8965#endif 8968#endif
8966 8969
8967 struct gcpro gcpro1; 8970 struct gcpro outer_gcpro1;
8968 8971
8969 GCPRO1 (fake_prefixed_keys); 8972 GCPRO1_VAR (fake_prefixed_keys, outer_gcpro);
8970 raw_keybuf_count = 0; 8973 raw_keybuf_count = 0;
8971 8974
8972 last_nonmenu_event = Qnil; 8975 last_nonmenu_event = Qnil;
@@ -9128,7 +9131,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9128 while those allow us to restart the entire key sequence, 9131 while those allow us to restart the entire key sequence,
9129 echo_local_start and keys_local_start allow us to throw away 9132 echo_local_start and keys_local_start allow us to throw away
9130 just one key. */ 9133 just one key. */
9131 int echo_local_start, keys_local_start, local_first_binding; 9134 int echo_local_start IF_LINT (= 0);
9135 int keys_local_start, local_first_binding;
9132 9136
9133 eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); 9137 eassert (indec.end == t || (indec.end > t && indec.end <= mock_input));
9134 eassert (indec.start <= indec.end); 9138 eassert (indec.start <= indec.end);
@@ -9260,7 +9264,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9260 if (EQ (key, Qt)) 9264 if (EQ (key, Qt))
9261 { 9265 {
9262 unbind_to (count, Qnil); 9266 unbind_to (count, Qnil);
9263 UNGCPRO; 9267 UNGCPRO_VAR (outer_gcpro);
9264 return -1; 9268 return -1;
9265 } 9269 }
9266 9270
@@ -9838,7 +9842,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9838 && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t 9842 && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t
9839 && INTEGERP (key) 9843 && INTEGERP (key)
9840 && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK)) 9844 && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK))
9841 && UPPERCASEP (XINT (key) & ~CHAR_MODIFIER_MASK)) 9845 && uppercasep (XINT (key) & ~CHAR_MODIFIER_MASK))
9842 || (XINT (key) & shift_modifier))) 9846 || (XINT (key) & shift_modifier)))
9843 { 9847 {
9844 Lisp_Object new_key; 9848 Lisp_Object new_key;
@@ -9849,7 +9853,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9849 if (XINT (key) & shift_modifier) 9853 if (XINT (key) & shift_modifier)
9850 XSETINT (new_key, XINT (key) & ~shift_modifier); 9854 XSETINT (new_key, XINT (key) & ~shift_modifier);
9851 else 9855 else
9852 XSETINT (new_key, (DOWNCASE (XINT (key) & ~CHAR_MODIFIER_MASK) 9856 XSETINT (new_key, (downcase (XINT (key) & ~CHAR_MODIFIER_MASK)
9853 | (XINT (key) & CHAR_MODIFIER_MASK))); 9857 | (XINT (key) & CHAR_MODIFIER_MASK)));
9854 9858
9855 /* We have to do this unconditionally, regardless of whether 9859 /* We have to do this unconditionally, regardless of whether
@@ -9877,13 +9881,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9877 || (INTEGERP (key) 9881 || (INTEGERP (key)
9878 && (KEY_TO_CHAR (key) 9882 && (KEY_TO_CHAR (key)
9879 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size) 9883 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size)
9880 && UPPERCASEP (KEY_TO_CHAR (key)))) 9884 && uppercasep (KEY_TO_CHAR (key))))
9881 { 9885 {
9882 Lisp_Object new_key 9886 Lisp_Object new_key
9883 = (modifiers & shift_modifier 9887 = (modifiers & shift_modifier
9884 ? apply_modifiers (modifiers & ~shift_modifier, 9888 ? apply_modifiers (modifiers & ~shift_modifier,
9885 XCAR (breakdown)) 9889 XCAR (breakdown))
9886 : make_number (DOWNCASE (KEY_TO_CHAR (key)) | modifiers)); 9890 : make_number (downcase (KEY_TO_CHAR (key)) | modifiers));
9887 9891
9888 original_uppercase = key; 9892 original_uppercase = key;
9889 original_uppercase_position = t - 1; 9893 original_uppercase_position = t - 1;
@@ -9943,7 +9947,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9943 add_command_key (keybuf[t]); 9947 add_command_key (keybuf[t]);
9944 } 9948 }
9945 9949
9946 UNGCPRO; 9950 UNGCPRO_VAR (outer_gcpro);
9947 return t; 9951 return t;
9948} 9952}
9949 9953
@@ -9990,11 +9994,11 @@ is nil, then the event will be put off until after the current key sequence.
9990sequences, where they wouldn't conflict with ordinary bindings. See 9994sequences, where they wouldn't conflict with ordinary bindings. See
9991`function-key-map' for more details. 9995`function-key-map' for more details.
9992 9996
9993The optional fifth argument COMMAND-LOOP, if non-nil, means 9997The optional fifth argument CMD-LOOP, if non-nil, means
9994that this key sequence is being read by something that will 9998that this key sequence is being read by something that will
9995read commands one after another. It should be nil if the caller 9999read commands one after another. It should be nil if the caller
9996will read just one key sequence. */) 10000will read just one key sequence. */)
9997 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) 10001 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop)
9998{ 10002{
9999 Lisp_Object keybuf[30]; 10003 Lisp_Object keybuf[30];
10000 register int i; 10004 register int i;
@@ -10006,9 +10010,9 @@ will read just one key sequence. */)
10006 QUIT; 10010 QUIT;
10007 10011
10008 specbind (Qinput_method_exit_on_first_char, 10012 specbind (Qinput_method_exit_on_first_char,
10009 (NILP (command_loop) ? Qt : Qnil)); 10013 (NILP (cmd_loop) ? Qt : Qnil));
10010 specbind (Qinput_method_use_echo_area, 10014 specbind (Qinput_method_use_echo_area,
10011 (NILP (command_loop) ? Qt : Qnil)); 10015 (NILP (cmd_loop) ? Qt : Qnil));
10012 10016
10013 memset (keybuf, 0, sizeof keybuf); 10017 memset (keybuf, 0, sizeof keybuf);
10014 GCPRO1 (keybuf[0]); 10018 GCPRO1 (keybuf[0]);
@@ -10051,7 +10055,7 @@ will read just one key sequence. */)
10051DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, 10055DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10052 Sread_key_sequence_vector, 1, 5, 0, 10056 Sread_key_sequence_vector, 1, 5, 0,
10053 doc: /* Like `read-key-sequence' but always return a vector. */) 10057 doc: /* Like `read-key-sequence' but always return a vector. */)
10054 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) 10058 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop)
10055{ 10059{
10056 Lisp_Object keybuf[30]; 10060 Lisp_Object keybuf[30];
10057 register int i; 10061 register int i;
@@ -10063,9 +10067,9 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10063 QUIT; 10067 QUIT;
10064 10068
10065 specbind (Qinput_method_exit_on_first_char, 10069 specbind (Qinput_method_exit_on_first_char,
10066 (NILP (command_loop) ? Qt : Qnil)); 10070 (NILP (cmd_loop) ? Qt : Qnil));
10067 specbind (Qinput_method_use_echo_area, 10071 specbind (Qinput_method_use_echo_area,
10068 (NILP (command_loop) ? Qt : Qnil)); 10072 (NILP (cmd_loop) ? Qt : Qnil));
10069 10073
10070 memset (keybuf, 0, sizeof keybuf); 10074 memset (keybuf, 0, sizeof keybuf);
10071 GCPRO1 (keybuf[0]); 10075 GCPRO1 (keybuf[0]);