aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-03-02 20:02:33 +0000
committerRichard M. Stallman1998-03-02 20:02:33 +0000
commite39da3d7772c5137078da16ad4c3ee2fe028307a (patch)
treee382f8f33c487e40986625562f515a14901acc81
parent84c9d21596fcb8676584a19bac632404419f7303 (diff)
downloademacs-e39da3d7772c5137078da16ad4c3ee2fe028307a.tar.gz
emacs-e39da3d7772c5137078da16ad4c3ee2fe028307a.zip
Include syntax.h.
(interrupt_signal): Save and restore gl_state around an immediate quit, in case debugger returns.
-rw-r--r--src/keyboard.c67
1 files changed, 62 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 83134989fa8..6e7eb42c7b9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA. */
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>
@@ -7081,6 +7082,44 @@ DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 4, 0,
7081 UNGCPRO; 7082 UNGCPRO;
7082 return make_event_array (i, keybuf); 7083 return make_event_array (i, keybuf);
7083} 7084}
7085
7086DEFUN ("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
7085DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0, 7124DEFUN ("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\
@@ -7437,18 +7476,26 @@ The value is a string or a vector.")
7437 XVECTOR (this_command_keys)->contents); 7476 XVECTOR (this_command_keys)->contents);
7438} 7477}
7439 7478
7479DEFUN ("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
7440DEFUN ("this-single-command-keys", Fthis_single_command_keys, 7487DEFUN ("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\
7443Unlike `this-command-keys', this function's value\n\ 7490Unlike `this-command-keys', this function's value\n\
7444does not include prefix arguments.\n\ 7491does not include prefix arguments.\n\
7445The value is a string or a vector.") 7492The 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
7454DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, 7501DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,
@@ -7775,9 +7822,17 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
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 */
@@ -8221,6 +8276,7 @@ syms_of_keyboard ()
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);
@@ -8229,6 +8285,7 @@ syms_of_keyboard ()
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);