diff options
| author | Stefan Monnier | 2015-09-03 16:02:28 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-09-03 16:02:28 -0400 |
| commit | 944d77f070da388b0c6e6578a9f868e88c088940 (patch) | |
| tree | 4b4525adbe8894560768e37214f9f82816fbd574 /src | |
| parent | c624ab229bdcefb42e4b81ff613e53c982f58cc1 (diff) | |
| download | emacs-944d77f070da388b0c6e6578a9f868e88c088940.tar.gz emacs-944d77f070da388b0c6e6578a9f868e88c088940.zip | |
Re-add the notion of echo_prompt lost in the translation
* src/keyboard.h (struct kboard): Replace echo_after_prompt with new
echo_prompt which contains the actual string. Update all uses.
* src/keyboard.c (kset_echo_prompt): New function.
(echo_update): Add echo_prompt at the very beginning.
(read_char): Remove workaround for bug#19875, not needed any more.
(read_key_sequence): Set echo_prompt rather than echo_string (bug#21403).
(mark_kboards): Mark echo_prompt.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 37 | ||||
| -rw-r--r-- | src/keyboard.h | 5 |
2 files changed, 22 insertions, 20 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index a8b1e9828bf..eefc033530a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -380,6 +380,11 @@ kset_echo_string (struct kboard *kb, Lisp_Object val) | |||
| 380 | kb->echo_string_ = val; | 380 | kb->echo_string_ = val; |
| 381 | } | 381 | } |
| 382 | static void | 382 | static void |
| 383 | kset_echo_prompt (struct kboard *kb, Lisp_Object val) | ||
| 384 | { | ||
| 385 | kb->echo_prompt_ = val; | ||
| 386 | } | ||
| 387 | static void | ||
| 383 | kset_kbd_queue (struct kboard *kb, Lisp_Object val) | 388 | kset_kbd_queue (struct kboard *kb, Lisp_Object val) |
| 384 | { | 389 | { |
| 385 | kb->kbd_queue_ = val; | 390 | kb->kbd_queue_ = val; |
| @@ -501,8 +506,9 @@ echo_dash (void) | |||
| 501 | return; | 506 | return; |
| 502 | 507 | ||
| 503 | /* Do nothing if we just printed a prompt. */ | 508 | /* Do nothing if we just printed a prompt. */ |
| 504 | if (current_kboard->echo_after_prompt | 509 | if (STRINGP (KVAR (current_kboard, echo_prompt)) |
| 505 | == SCHARS (KVAR (current_kboard, echo_string))) | 510 | && (SCHARS (KVAR (current_kboard, echo_prompt)) |
| 511 | == SCHARS (KVAR (current_kboard, echo_string)))) | ||
| 506 | return; | 512 | return; |
| 507 | 513 | ||
| 508 | /* Do nothing if we have already put a dash at the end. */ | 514 | /* Do nothing if we have already put a dash at the end. */ |
| @@ -534,8 +540,12 @@ echo_update (void) | |||
| 534 | if (current_kboard->immediate_echo) | 540 | if (current_kboard->immediate_echo) |
| 535 | { | 541 | { |
| 536 | ptrdiff_t i; | 542 | ptrdiff_t i; |
| 543 | Lisp_Object prompt = KVAR (current_kboard, echo_prompt); | ||
| 544 | Lisp_Object prefix = call0 (Qinternal_echo_keystrokes_prefix); | ||
| 537 | kset_echo_string (current_kboard, | 545 | kset_echo_string (current_kboard, |
| 538 | call0 (Qinternal_echo_keystrokes_prefix)); | 546 | NILP (prompt) ? prefix |
| 547 | : NILP (prefix) ? prompt | ||
| 548 | : concat2 (prompt, prefix)); | ||
| 539 | 549 | ||
| 540 | for (i = 0; i < this_command_key_count; i++) | 550 | for (i = 0; i < this_command_key_count; i++) |
| 541 | { | 551 | { |
| @@ -584,7 +594,7 @@ void | |||
| 584 | cancel_echoing (void) | 594 | cancel_echoing (void) |
| 585 | { | 595 | { |
| 586 | current_kboard->immediate_echo = false; | 596 | current_kboard->immediate_echo = false; |
| 587 | current_kboard->echo_after_prompt = -1; | 597 | kset_echo_prompt (current_kboard, Qnil); |
| 588 | kset_echo_string (current_kboard, Qnil); | 598 | kset_echo_string (current_kboard, Qnil); |
| 589 | ok_to_echo_at_next_pause = NULL; | 599 | ok_to_echo_at_next_pause = NULL; |
| 590 | echo_kboard = NULL; | 600 | echo_kboard = NULL; |
| @@ -2942,7 +2952,7 @@ read_char (int commandflag, Lisp_Object map, | |||
| 2942 | bool saved_immediate_echo = current_kboard->immediate_echo; | 2952 | bool saved_immediate_echo = current_kboard->immediate_echo; |
| 2943 | struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; | 2953 | struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; |
| 2944 | Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); | 2954 | Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); |
| 2945 | ptrdiff_t saved_echo_after_prompt = current_kboard->echo_after_prompt; | 2955 | Lisp_Object saved_echo_prompt = KVAR (current_kboard, echo_prompt); |
| 2946 | 2956 | ||
| 2947 | /* Save the this_command_keys status. */ | 2957 | /* Save the this_command_keys status. */ |
| 2948 | key_count = this_command_key_count; | 2958 | key_count = this_command_key_count; |
| @@ -2984,15 +2994,8 @@ read_char (int commandflag, Lisp_Object map, | |||
| 2984 | 2994 | ||
| 2985 | cancel_echoing (); | 2995 | cancel_echoing (); |
| 2986 | ok_to_echo_at_next_pause = saved_ok_to_echo; | 2996 | ok_to_echo_at_next_pause = saved_ok_to_echo; |
| 2987 | /* Do not restore the echo area string when the user is | 2997 | kset_echo_string (current_kboard, saved_echo_string); |
| 2988 | introducing a prefix argument. Otherwise we end with | 2998 | kset_echo_prompt (current_kboard, saved_echo_prompt); |
| 2989 | repetitions of the partially introduced prefix | ||
| 2990 | argument. (bug#19875) */ | ||
| 2991 | if (NILP (intern ("prefix-arg"))) | ||
| 2992 | { | ||
| 2993 | kset_echo_string (current_kboard, saved_echo_string); | ||
| 2994 | } | ||
| 2995 | current_kboard->echo_after_prompt = saved_echo_after_prompt; | ||
| 2996 | if (saved_immediate_echo) | 2999 | if (saved_immediate_echo) |
| 2997 | echo_now (); | 3000 | echo_now (); |
| 2998 | 3001 | ||
| @@ -8870,8 +8873,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 8870 | /* Install the string PROMPT as the beginning of the string | 8873 | /* Install the string PROMPT as the beginning of the string |
| 8871 | of echoing, so that it serves as a prompt for the next | 8874 | of echoing, so that it serves as a prompt for the next |
| 8872 | character. */ | 8875 | character. */ |
| 8873 | kset_echo_string (current_kboard, prompt); | 8876 | kset_echo_prompt (current_kboard, prompt); |
| 8874 | current_kboard->echo_after_prompt = SCHARS (prompt); | ||
| 8875 | echo_now (); | 8877 | echo_now (); |
| 8876 | } | 8878 | } |
| 8877 | else if (cursor_in_echo_area | 8879 | else if (cursor_in_echo_area |
| @@ -10695,7 +10697,7 @@ init_kboard (KBOARD *kb, Lisp_Object type) | |||
| 10695 | kb->kbd_queue_has_data = false; | 10697 | kb->kbd_queue_has_data = false; |
| 10696 | kb->immediate_echo = false; | 10698 | kb->immediate_echo = false; |
| 10697 | kset_echo_string (kb, Qnil); | 10699 | kset_echo_string (kb, Qnil); |
| 10698 | kb->echo_after_prompt = -1; | 10700 | kset_echo_prompt (kb, Qnil); |
| 10699 | kb->kbd_macro_buffer = 0; | 10701 | kb->kbd_macro_buffer = 0; |
| 10700 | kb->kbd_macro_bufsize = 0; | 10702 | kb->kbd_macro_bufsize = 0; |
| 10701 | kset_defining_kbd_macro (kb, Qnil); | 10703 | kset_defining_kbd_macro (kb, Qnil); |
| @@ -11758,6 +11760,7 @@ mark_kboards (void) | |||
| 11758 | mark_object (KVAR (kb, Vlocal_function_key_map)); | 11760 | mark_object (KVAR (kb, Vlocal_function_key_map)); |
| 11759 | mark_object (KVAR (kb, Vdefault_minibuffer_frame)); | 11761 | mark_object (KVAR (kb, Vdefault_minibuffer_frame)); |
| 11760 | mark_object (KVAR (kb, echo_string)); | 11762 | mark_object (KVAR (kb, echo_string)); |
| 11763 | mark_object (KVAR (kb, echo_prompt)); | ||
| 11761 | } | 11764 | } |
| 11762 | { | 11765 | { |
| 11763 | union buffered_input_event *event; | 11766 | union buffered_input_event *event; |
diff --git a/src/keyboard.h b/src/keyboard.h index 3e4c475d285..0402e0a582c 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -175,9 +175,8 @@ struct kboard | |||
| 175 | /* True means echo each character as typed. */ | 175 | /* True means echo each character as typed. */ |
| 176 | bool_bf immediate_echo : 1; | 176 | bool_bf immediate_echo : 1; |
| 177 | 177 | ||
| 178 | /* If we have echoed a prompt string specified by the user, | 178 | /* If we have a prompt string specified by the user, this is it. */ |
| 179 | this is its length in characters. Otherwise this is -1. */ | 179 | Lisp_Object echo_prompt_; |
| 180 | ptrdiff_t echo_after_prompt; | ||
| 181 | }; | 180 | }; |
| 182 | 181 | ||
| 183 | INLINE void | 182 | INLINE void |