comparison src/keyboard.c @ 21024:396f070a8011

Include syntax.h. (interrupt_signal): Save and restore gl_state around an immediate quit, in case debugger returns.
author Richard M. Stallman <rms@gnu.org>
date Mon, 02 Mar 1998 20:02:33 +0000
parents bfc5d6ebba37
children bff697e03fe0
comparison
equal deleted inserted replaced
21023:bac070da6b6d 21024:396f070a8011
34 #include "buffer.h" 34 #include "buffer.h"
35 #include "charset.h" 35 #include "charset.h"
36 #include "disptab.h" 36 #include "disptab.h"
37 #include "dispextern.h" 37 #include "dispextern.h"
38 #include "keyboard.h" 38 #include "keyboard.h"
39 #include "syntax.h"
39 #include "intervals.h" 40 #include "intervals.h"
40 #include "blockinput.h" 41 #include "blockinput.h"
41 #include <setjmp.h> 42 #include <setjmp.h>
42 #include <errno.h> 43 #include <errno.h>
43 44
7079 QUIT; 7080 QUIT;
7080 } 7081 }
7081 UNGCPRO; 7082 UNGCPRO;
7082 return make_event_array (i, keybuf); 7083 return make_event_array (i, keybuf);
7083 } 7084 }
7085
7086 DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
7087 Sread_key_sequence_vector, 1, 4, 0,
7088 "Like `read-key-sequence' but always return a vector.")
7089 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame)
7090 Lisp_Object prompt, continue_echo, dont_downcase_last;
7091 Lisp_Object can_return_switch_frame;
7092 {
7093 Lisp_Object keybuf[30];
7094 register int i;
7095 struct gcpro gcpro1, gcpro2;
7096
7097 if (!NILP (prompt))
7098 CHECK_STRING (prompt, 0);
7099 QUIT;
7100
7101 bzero (keybuf, sizeof keybuf);
7102 GCPRO1 (keybuf[0]);
7103 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
7104
7105 if (NILP (continue_echo))
7106 {
7107 this_command_key_count = 0;
7108 this_single_command_key_start = 0;
7109 }
7110
7111 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
7112 prompt, ! NILP (dont_downcase_last),
7113 ! NILP (can_return_switch_frame), 0);
7114
7115 if (i == -1)
7116 {
7117 Vquit_flag = Qt;
7118 QUIT;
7119 }
7120 UNGCPRO;
7121 return Fvector (i, keybuf);
7122 }
7084 7123
7085 DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0, 7124 DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0,
7086 "Execute CMD as an editor command.\n\ 7125 "Execute CMD as an editor command.\n\
7087 CMD must be a symbol that satisfies the `commandp' predicate.\n\ 7126 CMD must be a symbol that satisfies the `commandp' predicate.\n\
7088 Optional second arg RECORD-FLAG non-nil\n\ 7127 Optional second arg RECORD-FLAG non-nil\n\
7435 { 7474 {
7436 return make_event_array (this_command_key_count, 7475 return make_event_array (this_command_key_count,
7437 XVECTOR (this_command_keys)->contents); 7476 XVECTOR (this_command_keys)->contents);
7438 } 7477 }
7439 7478
7479 DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0,
7480 "Return the key sequence that invoked this command, as a vector.")
7481 ()
7482 {
7483 return Fvector (this_command_key_count,
7484 XVECTOR (this_command_keys)->contents);
7485 }
7486
7440 DEFUN ("this-single-command-keys", Fthis_single_command_keys, 7487 DEFUN ("this-single-command-keys", Fthis_single_command_keys,
7441 Sthis_single_command_keys, 0, 0, 0, 7488 Sthis_single_command_keys, 0, 0, 0,
7442 "Return the key sequence that invoked this command.\n\ 7489 "Return the key sequence that invoked this command.\n\
7443 Unlike `this-command-keys', this function's value\n\ 7490 Unlike `this-command-keys', this function's value\n\
7444 does not include prefix arguments.\n\ 7491 does not include prefix arguments.\n\
7445 The value is a string or a vector.") 7492 The value is always a vector.")
7446 () 7493 ()
7447 { 7494 {
7448 return make_event_array (this_command_key_count 7495 return Fvector (this_command_key_count
7449 - this_single_command_key_start, 7496 - this_single_command_key_start,
7450 (XVECTOR (this_command_keys)->contents 7497 (XVECTOR (this_command_keys)->contents
7451 + this_single_command_key_start)); 7498 + this_single_command_key_start));
7452 } 7499 }
7453 7500
7454 DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, 7501 DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,
7455 Sreset_this_command_lengths, 0, 0, 0, 7502 Sreset_this_command_lengths, 0, 0, 0,
7456 "Used for complicated reasons in `universal-argument-other-key'.\n\ 7503 "Used for complicated reasons in `universal-argument-other-key'.\n\
7773 /* If executing a function that wants to be interrupted out of 7820 /* If executing a function that wants to be interrupted out of
7774 and the user has not deferred quitting by binding `inhibit-quit' 7821 and the user has not deferred quitting by binding `inhibit-quit'
7775 then quit right away. */ 7822 then quit right away. */
7776 if (immediate_quit && NILP (Vinhibit_quit)) 7823 if (immediate_quit && NILP (Vinhibit_quit))
7777 { 7824 {
7825 struct gl_state_s saved;
7826 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
7827
7778 immediate_quit = 0; 7828 immediate_quit = 0;
7779 sigfree (); 7829 sigfree ();
7830 saved = gl_state;
7831 GCPRO4 (saved.object, saved.global_code,
7832 saved.current_syntax_table, saved.old_prop);
7780 Fsignal (Qquit, Qnil); 7833 Fsignal (Qquit, Qnil);
7834 gl_state = saved;
7835 UNGCPRO;
7781 } 7836 }
7782 else 7837 else
7783 /* Else request quit when it's safe */ 7838 /* Else request quit when it's safe */
7784 Vquit_flag = Qt; 7839 Vquit_flag = Qt;
7785 } 7840 }
8219 read_key_sequence_cmd = Qnil; 8274 read_key_sequence_cmd = Qnil;
8220 staticpro (&read_key_sequence_cmd); 8275 staticpro (&read_key_sequence_cmd);
8221 8276
8222 defsubr (&Sevent_convert_list); 8277 defsubr (&Sevent_convert_list);
8223 defsubr (&Sread_key_sequence); 8278 defsubr (&Sread_key_sequence);
8279 defsubr (&Sread_key_sequence_vector);
8224 defsubr (&Srecursive_edit); 8280 defsubr (&Srecursive_edit);
8225 #ifdef HAVE_MOUSE 8281 #ifdef HAVE_MOUSE
8226 defsubr (&Strack_mouse); 8282 defsubr (&Strack_mouse);
8227 #endif 8283 #endif
8228 defsubr (&Sinput_pending_p); 8284 defsubr (&Sinput_pending_p);
8229 defsubr (&Scommand_execute); 8285 defsubr (&Scommand_execute);
8230 defsubr (&Srecent_keys); 8286 defsubr (&Srecent_keys);
8231 defsubr (&Sthis_command_keys); 8287 defsubr (&Sthis_command_keys);
8288 defsubr (&Sthis_command_keys_vector);
8232 defsubr (&Sthis_single_command_keys); 8289 defsubr (&Sthis_single_command_keys);
8233 defsubr (&Sreset_this_command_lengths); 8290 defsubr (&Sreset_this_command_lengths);
8234 defsubr (&Ssuspend_emacs); 8291 defsubr (&Ssuspend_emacs);
8235 defsubr (&Sabort_recursive_edit); 8292 defsubr (&Sabort_recursive_edit);
8236 defsubr (&Sexit_recursive_edit); 8293 defsubr (&Sexit_recursive_edit);