comparison src/keyboard.c @ 4878:57c506c597b9

(read_key_sequence): Arg prompt is now a Lisp object. Pass it to functions found in function-key-map and key-translation-map. (Fread_key_sequence, command_loop_1): Calls changed.
author Richard M. Stallman <rms@gnu.org>
date Sun, 24 Oct 1993 23:28:06 +0000
parents 5ebf3eec091b
children 2f9a58694d43
comparison
equal deleted inserted replaced
4877:4c51d8a8b09f 4878:57c506c597b9
992 } 992 }
993 #endif /* MULTI_FRAME */ 993 #endif /* MULTI_FRAME */
994 #endif /* 0 */ 994 #endif /* 0 */
995 995
996 /* Read next key sequence; i gets its length. */ 996 /* Read next key sequence; i gets its length. */
997 i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), 0); 997 i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), Qnil);
998 998
999 ++num_input_keys; 999 ++num_input_keys;
1000 1000
1001 /* Now we have read a key sequence of length I, 1001 /* Now we have read a key sequence of length I,
1002 or else I is 0 and we found end of file. */ 1002 or else I is 0 and we found end of file. */
3713 3713
3714 static int 3714 static int
3715 read_key_sequence (keybuf, bufsize, prompt) 3715 read_key_sequence (keybuf, bufsize, prompt)
3716 Lisp_Object *keybuf; 3716 Lisp_Object *keybuf;
3717 int bufsize; 3717 int bufsize;
3718 char *prompt; 3718 Lisp_Object prompt;
3719 { 3719 {
3720 int count = specpdl_ptr - specpdl; 3720 int count = specpdl_ptr - specpdl;
3721 3721
3722 /* How many keys there are in the current key sequence. */ 3722 /* How many keys there are in the current key sequence. */
3723 int t; 3723 int t;
3800 if (NILP (Fkeymapp (Vkey_translation_map))) 3800 if (NILP (Fkeymapp (Vkey_translation_map)))
3801 keytran_start = keytran_end = bufsize + 1; 3801 keytran_start = keytran_end = bufsize + 1;
3802 3802
3803 if (INTERACTIVE) 3803 if (INTERACTIVE)
3804 { 3804 {
3805 if (prompt) 3805 if (!NILP (prompt))
3806 echo_prompt (prompt); 3806 echo_prompt (XSTRING (prompt)->data);
3807 else if (cursor_in_echo_area) 3807 else if (cursor_in_echo_area)
3808 /* This doesn't put in a dash if the echo buffer is empty, so 3808 /* This doesn't put in a dash if the echo buffer is empty, so
3809 you don't always see a dash hanging out in the minibuffer. */ 3809 you don't always see a dash hanging out in the minibuffer. */
3810 echo_dash (); 3810 echo_dash ();
3811 } 3811 }
3821 does cannot safely be bypassed. It seems too risky to try to make 3821 does cannot safely be bypassed. It seems too risky to try to make
3822 this work right. */ 3822 this work right. */
3823 3823
3824 /* Read the first char of the sequence specially, before setting 3824 /* Read the first char of the sequence specially, before setting
3825 up any keymaps, in case a filter runs and switches buffers on us. */ 3825 up any keymaps, in case a filter runs and switches buffers on us. */
3826 first_event = read_char (!prompt, 0, submaps, last_nonmenu_event, 3826 first_event = read_char (NILP (prompt), 0, submaps, last_nonmenu_event,
3827 &junk); 3827 &junk);
3828 #endif /* GOBBLE_FIRST_EVENT */ 3828 #endif /* GOBBLE_FIRST_EVENT */
3829 3829
3830 /* We jump here when the key sequence has been thoroughly changed, and 3830 /* We jump here when the key sequence has been thoroughly changed, and
3831 we need to rescan it starting from the beginning. When we jump here, 3831 we need to rescan it starting from the beginning. When we jump here,
3933 /* If not, we should actually read a character. */ 3933 /* If not, we should actually read a character. */
3934 else 3934 else
3935 { 3935 {
3936 struct buffer *buf = current_buffer; 3936 struct buffer *buf = current_buffer;
3937 3937
3938 key = read_char (!prompt, nmaps, submaps, last_nonmenu_event, 3938 key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event,
3939 &used_mouse_menu); 3939 &used_mouse_menu);
3940 3940
3941 /* read_char returns t when it shows a menu and the user rejects it. 3941 /* read_char returns t when it shows a menu and the user rejects it.
3942 Just return -1. */ 3942 Just return -1. */
3943 if (EQ (key, Qt)) 3943 if (EQ (key, Qt))
4250 struct gcpro gcpro1, gcpro2, gcpro3; 4250 struct gcpro gcpro1, gcpro2, gcpro3;
4251 Lisp_Object tem; 4251 Lisp_Object tem;
4252 tem = fkey_next; 4252 tem = fkey_next;
4253 4253
4254 GCPRO3 (fkey_map, keytran_map, delayed_switch_frame); 4254 GCPRO3 (fkey_map, keytran_map, delayed_switch_frame);
4255 fkey_next = call0 (fkey_next); 4255 fkey_next = call1 (fkey_next, prompt);
4256 UNGCPRO; 4256 UNGCPRO;
4257 /* If the function returned something invalid, 4257 /* If the function returned something invalid,
4258 barf--don't ignore it. 4258 barf--don't ignore it.
4259 (To ignore it safely, we would need to gcpro a bunch of 4259 (To ignore it safely, we would need to gcpro a bunch of
4260 other variables.) */ 4260 other variables.) */
4343 struct gcpro gcpro1, gcpro2, gcpro3; 4343 struct gcpro gcpro1, gcpro2, gcpro3;
4344 Lisp_Object tem; 4344 Lisp_Object tem;
4345 tem = keytran_next; 4345 tem = keytran_next;
4346 4346
4347 GCPRO3 (keytran_map, keytran_map, delayed_switch_frame); 4347 GCPRO3 (keytran_map, keytran_map, delayed_switch_frame);
4348 keytran_next = call0 (keytran_next); 4348 keytran_next = call1 (keytran_next, prompt);
4349 UNGCPRO; 4349 UNGCPRO;
4350 /* If the function returned something invalid, 4350 /* If the function returned something invalid,
4351 barf--don't ignore it. 4351 barf--don't ignore it.
4352 (To ignore it safely, we would need to gcpro a bunch of 4352 (To ignore it safely, we would need to gcpro a bunch of
4353 other variables.) */ 4353 other variables.) */
4483 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); 4483 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
4484 4484
4485 if (NILP (continue_echo)) 4485 if (NILP (continue_echo))
4486 this_command_key_count = 0; 4486 this_command_key_count = 0;
4487 4487
4488 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), 4488 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), prompt);
4489 NILP (prompt) ? 0 : XSTRING (prompt)->data);
4490 4489
4491 if (i == -1) 4490 if (i == -1)
4492 { 4491 {
4493 Vquit_flag = Qt; 4492 Vquit_flag = Qt;
4494 QUIT; 4493 QUIT;