comparison src/keyboard.c @ 9272:0a0998c4d4b6

(command_loop_1, read_char, Ftrack_mouse, kbd_buffer_get_event, make_lispy_event, make_lispy_movement, modify_event_symbol, read_avail_input, follow_key, syms_of_keyboard): Use new accessor macros instead of calling XSET directly.
author Karl Heuer <kwzh@gnu.org>
date Tue, 04 Oct 1994 12:13:17 +0000
parents 2ac31fc0facb
children 6e40f49dc6fb
comparison
equal deleted inserted replaced
9271:1971a6a8cdc0 9272:0a0998c4d4b6
1088 no_redisplay = 0; 1088 no_redisplay = 0;
1089 1089
1090 prev_buffer = current_buffer; 1090 prev_buffer = current_buffer;
1091 prev_modiff = MODIFF; 1091 prev_modiff = MODIFF;
1092 last_point_position = PT; 1092 last_point_position = PT;
1093 XSET (last_point_position_buffer, Lisp_Buffer, prev_buffer); 1093 XSETBUFFER (last_point_position_buffer, prev_buffer);
1094 1094
1095 /* Execute the command. */ 1095 /* Execute the command. */
1096 1096
1097 this_command = cmd; 1097 this_command = cmd;
1098 /* Note that the value cell will never directly contain nil 1098 /* Note that the value cell will never directly contain nil
1498 goto reread; 1498 goto reread;
1499 } 1499 }
1500 1500
1501 if (unread_command_char != -1) 1501 if (unread_command_char != -1)
1502 { 1502 {
1503 XSET (c, Lisp_Int, unread_command_char); 1503 XSETINT (c, unread_command_char);
1504 unread_command_char = -1; 1504 unread_command_char = -1;
1505 1505
1506 if (this_command_key_count == 0) 1506 if (this_command_key_count == 0)
1507 goto reread_first; 1507 goto reread_first;
1508 else 1508 else
1529 Also, some things replace the macro with t 1529 Also, some things replace the macro with t
1530 to force an early exit. */ 1530 to force an early exit. */
1531 if (EQ (Vexecuting_macro, Qt) 1531 if (EQ (Vexecuting_macro, Qt)
1532 || executing_macro_index >= XFASTINT (Flength (Vexecuting_macro))) 1532 || executing_macro_index >= XFASTINT (Flength (Vexecuting_macro)))
1533 { 1533 {
1534 XSET (c, Lisp_Int, -1); 1534 XSETINT (c, -1);
1535 return c; 1535 return c;
1536 } 1536 }
1537 1537
1538 c = Faref (Vexecuting_macro, make_number (executing_macro_index)); 1538 c = Faref (Vexecuting_macro, make_number (executing_macro_index));
1539 if (STRINGP (Vexecuting_macro) 1539 if (STRINGP (Vexecuting_macro)
1569 if (commandflag >= 0 && !input_pending && !detect_input_pending ()) 1569 if (commandflag >= 0 && !input_pending && !detect_input_pending ())
1570 redisplay (); 1570 redisplay ();
1571 1571
1572 if (_setjmp (getcjmp)) 1572 if (_setjmp (getcjmp))
1573 { 1573 {
1574 XSET (c, Lisp_Int, quit_char); 1574 XSETINT (c, quit_char);
1575 #ifdef MULTI_FRAME 1575 #ifdef MULTI_FRAME
1576 XSET (internal_last_event_frame, Lisp_Frame, selected_frame); 1576 XSETFRAME (internal_last_event_frame, selected_frame);
1577 Vlast_event_frame = internal_last_event_frame; 1577 Vlast_event_frame = internal_last_event_frame;
1578 #endif 1578 #endif
1579 /* If we report the quit char as an event, 1579 /* If we report the quit char as an event,
1580 don't do so more than once. */ 1580 don't do so more than once. */
1581 if (!NILP (Vinhibit_quit)) 1581 if (!NILP (Vinhibit_quit))
1914 Lisp_Object args; 1914 Lisp_Object args;
1915 { 1915 {
1916 int count = specpdl_ptr - specpdl; 1916 int count = specpdl_ptr - specpdl;
1917 Lisp_Object val; 1917 Lisp_Object val;
1918 1918
1919 XSET (val, Lisp_Int, do_mouse_tracking); 1919 XSETINT (val, do_mouse_tracking);
1920 record_unwind_protect (tracking_off, val); 1920 record_unwind_protect (tracking_off, val);
1921 1921
1922 if (!input_pending && !detect_input_pending ()) 1922 if (!input_pending && !detect_input_pending ())
1923 prepare_menu_bars (); 1923 prepare_menu_bars ();
1924 1924
2046 Lisp_Object obj; 2046 Lisp_Object obj;
2047 2047
2048 if (noninteractive) 2048 if (noninteractive)
2049 { 2049 {
2050 c = getchar (); 2050 c = getchar ();
2051 XSET (obj, Lisp_Int, c); 2051 XSETINT (obj, c);
2052 return obj; 2052 return obj;
2053 } 2053 }
2054 2054
2055 /* Wait until there is input available. */ 2055 /* Wait until there is input available. */
2056 for (;;) 2056 for (;;)
2075 #endif /* SIGIO */ 2075 #endif /* SIGIO */
2076 if (EVENT_QUEUES_EMPTY) 2076 if (EVENT_QUEUES_EMPTY)
2077 { 2077 {
2078 Lisp_Object minus_one; 2078 Lisp_Object minus_one;
2079 2079
2080 XSET (minus_one, Lisp_Int, -1); 2080 XSETINT (minus_one, -1);
2081 wait_reading_process_input (0, 0, minus_one, 1); 2081 wait_reading_process_input (0, 0, minus_one, 1);
2082 2082
2083 if (!interrupt_input && EVENT_QUEUES_EMPTY) 2083 if (!interrupt_input && EVENT_QUEUES_EMPTY)
2084 /* Pass 1 for EXPECT since we just waited to have input. */ 2084 /* Pass 1 for EXPECT since we just waited to have input. */
2085 read_avail_input (1); 2085 read_avail_input (1);
2144 kbd_fetch_ptr = event + 1; 2144 kbd_fetch_ptr = event + 1;
2145 } 2145 }
2146 else if (event->kind == buffer_switch_event) 2146 else if (event->kind == buffer_switch_event)
2147 { 2147 {
2148 /* The value doesn't matter here; only the type is tested. */ 2148 /* The value doesn't matter here; only the type is tested. */
2149 XSET (obj, Lisp_Buffer, current_buffer); 2149 XSETBUFFER (obj, current_buffer);
2150 kbd_fetch_ptr = event + 1; 2150 kbd_fetch_ptr = event + 1;
2151 } 2151 }
2152 /* Just discard these, by returning nil. 2152 /* Just discard these, by returning nil.
2153 (They shouldn't be found in the buffer, 2153 (They shouldn't be found in the buffer,
2154 but on some machines it appears they do show up.) */ 2154 but on some machines it appears they do show up.) */
2214 { 2214 {
2215 Lisp_Object frame; 2215 Lisp_Object frame;
2216 2216
2217 frame = FRAME_FOCUS_FRAME (f); 2217 frame = FRAME_FOCUS_FRAME (f);
2218 if (NILP (frame)) 2218 if (NILP (frame))
2219 XSET (frame, Lisp_Frame, f); 2219 XSETFRAME (frame, f);
2220 2220
2221 if (! EQ (frame, internal_last_event_frame) 2221 if (! EQ (frame, internal_last_event_frame)
2222 && XFRAME (frame) != selected_frame) 2222 && XFRAME (frame) != selected_frame)
2223 obj = make_lispy_switch_frame (frame); 2223 obj = make_lispy_switch_frame (frame);
2224 internal_last_event_frame = frame; 2224 internal_last_event_frame = frame;
2710 if (part == 1) 2710 if (part == 1)
2711 posn = Qmode_line; 2711 posn = Qmode_line;
2712 else if (part == 2) 2712 else if (part == 2)
2713 posn = Qvertical_line; 2713 posn = Qvertical_line;
2714 else 2714 else
2715 XSET (posn, Lisp_Int, 2715 XSETINT (posn,
2716 buffer_posn_from_coords (XWINDOW (window), 2716 buffer_posn_from_coords (XWINDOW (window),
2717 column, row)); 2717 column, row));
2718 } 2718 }
2719 2719
2720 position 2720 position
2721 = Fcons (window, 2721 = Fcons (window,
2722 Fcons (posn, 2722 Fcons (posn,
2919 if (area == 1) 2919 if (area == 1)
2920 posn = Qmode_line; 2920 posn = Qmode_line;
2921 else if (area == 2) 2921 else if (area == 2)
2922 posn = Qvertical_line; 2922 posn = Qvertical_line;
2923 else 2923 else
2924 XSET (posn, Lisp_Int, 2924 XSETINT (posn,
2925 buffer_posn_from_coords (XWINDOW (window), column, row)); 2925 buffer_posn_from_coords (XWINDOW (window), column, row));
2926 } 2926 }
2927 #ifdef MULTI_FRAME 2927 #ifdef MULTI_FRAME
2928 else if (frame != 0) 2928 else if (frame != 0)
2929 { 2929 {
2930 XSET (window, Lisp_Frame, frame); 2930 XSETFRAME (window, frame);
2931 posn = Qnil; 2931 posn = Qnil;
2932 } 2932 }
2933 #endif 2933 #endif
2934 else 2934 else
2935 { 2935 {
3328 int table_size; 3328 int table_size;
3329 { 3329 {
3330 Lisp_Object value; 3330 Lisp_Object value;
3331 Lisp_Object symbol_int; 3331 Lisp_Object symbol_int;
3332 3332
3333 XSET (symbol_int, Lisp_Int, symbol_num); 3333 XSETINT (symbol_int, symbol_num);
3334 3334
3335 /* Is this a request for a valid symbol? */ 3335 /* Is this a request for a valid symbol? */
3336 if (symbol_num < 0 || symbol_num >= table_size) 3336 if (symbol_num < 0 || symbol_num >= table_size)
3337 return Qnil; 3337 return Qnil;
3338 3338
3598 if (meta_key == 1 && (cbuf[i] & 0x80)) 3598 if (meta_key == 1 && (cbuf[i] & 0x80))
3599 buf[i].modifiers = meta_modifier; 3599 buf[i].modifiers = meta_modifier;
3600 if (meta_key != 2) 3600 if (meta_key != 2)
3601 cbuf[i] &= ~0x80; 3601 cbuf[i] &= ~0x80;
3602 3602
3603 XSET (buf[i].code, Lisp_Int, cbuf[i]); 3603 XSETINT (buf[i].code, cbuf[i]);
3604 #ifdef MULTI_FRAME 3604 #ifdef MULTI_FRAME
3605 XSET (buf[i].frame_or_window, Lisp_Frame, selected_frame); 3605 XSETFRAME (buf[i].frame_or_window, selected_frame);
3606 #else 3606 #else
3607 buf[i].frame_or_window = Qnil; 3607 buf[i].frame_or_window = Qnil;
3608 #endif 3608 #endif
3609 } 3609 }
3610 } 3610 }
4295 } 4295 }
4296 else 4296 else
4297 next[i] = Qnil; 4297 next[i] = Qnil;
4298 4298
4299 current = next; 4299 current = next;
4300 XSET (key, Lisp_Int, XFASTINT (key) & ~CHAR_META); 4300 XSETINT (key, XFASTINT (key) & ~CHAR_META);
4301 } 4301 }
4302 4302
4303 first_binding = nmaps; 4303 first_binding = nmaps;
4304 for (i = nmaps - 1; i >= 0; i--) 4304 for (i = nmaps - 1; i >= 0; i--)
4305 { 4305 {
6087 "If not -1, an object to be read as next command input event."); 6087 "If not -1, an object to be read as next command input event.");
6088 6088
6089 DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char, 6089 DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char,
6090 "Meta-prefix character code. Meta-foo as command input\n\ 6090 "Meta-prefix character code. Meta-foo as command input\n\
6091 turns into this character followed by foo."); 6091 turns into this character followed by foo.");
6092 XSET (meta_prefix_char, Lisp_Int, 033); 6092 XSETINT (meta_prefix_char, 033);
6093 6093
6094 DEFVAR_LISP ("last-command", &last_command, 6094 DEFVAR_LISP ("last-command", &last_command,
6095 "The last command executed. Normally a symbol with a function definition,\n\ 6095 "The last command executed. Normally a symbol with a function definition,\n\
6096 but can be whatever was found in the keymap, or whatever the variable\n\ 6096 but can be whatever was found in the keymap, or whatever the variable\n\
6097 `this-command' was set to by that command."); 6097 `this-command' was set to by that command.");
6144 6144
6145 DEFVAR_LISP ("help-char", &Vhelp_char, 6145 DEFVAR_LISP ("help-char", &Vhelp_char,
6146 "Character to recognize as meaning Help.\n\ 6146 "Character to recognize as meaning Help.\n\
6147 When it is read, do `(eval help-form)', and display result if it's a string.\n\ 6147 When it is read, do `(eval help-form)', and display result if it's a string.\n\
6148 If the value of `help-form' is nil, this char can be read normally."); 6148 If the value of `help-form' is nil, this char can be read normally.");
6149 XSET (Vhelp_char, Lisp_Int, Ctl ('H')); 6149 XSETINT (Vhelp_char, Ctl ('H'));
6150 6150
6151 DEFVAR_LISP ("help-form", &Vhelp_form, 6151 DEFVAR_LISP ("help-form", &Vhelp_form,
6152 "Form to execute when character `help-char' is read.\n\ 6152 "Form to execute when character `help-char' is read.\n\
6153 If the form returns a string, that string is displayed.\n\ 6153 If the form returns a string, that string is displayed.\n\
6154 If `help-form' is nil, the help char is not recognized."); 6154 If `help-form' is nil, the help char is not recognized.");
6193 menu_prompting = 1; 6193 menu_prompting = 1;
6194 6194
6195 DEFVAR_LISP ("menu-prompt-more-char", &menu_prompt_more_char, 6195 DEFVAR_LISP ("menu-prompt-more-char", &menu_prompt_more_char,
6196 "Character to see next line of menu prompt.\n\ 6196 "Character to see next line of menu prompt.\n\
6197 Type this character while in a menu prompt to rotate around the lines of it."); 6197 Type this character while in a menu prompt to rotate around the lines of it.");
6198 XSET (menu_prompt_more_char, Lisp_Int, ' '); 6198 XSETINT (menu_prompt_more_char, ' ');
6199 6199
6200 DEFVAR_INT ("extra-keyboard-modifiers", &extra_keyboard_modifiers, 6200 DEFVAR_INT ("extra-keyboard-modifiers", &extra_keyboard_modifiers,
6201 "A mask of additional modifier keys to use with every keyboard character.\n\ 6201 "A mask of additional modifier keys to use with every keyboard character.\n\
6202 Emacs applies the modifiers of the character stored here to each keyboard\n\ 6202 Emacs applies the modifiers of the character stored here to each keyboard\n\
6203 character it reads. For example, after evaluating the expression\n\ 6203 character it reads. For example, after evaluating the expression\n\