diff options
| author | Gerd Moellmann | 2000-04-20 21:00:43 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-04-20 21:00:43 +0000 |
| commit | 59a84f8e16e2251e56e86d261f24cd209ded2946 (patch) | |
| tree | c4a601f50a92ffadf2dcb358bc98e5e9a4c45daf /src | |
| parent | a557aabd99b573a47e031b0aaeed390ecee00ac3 (diff) | |
| download | emacs-59a84f8e16e2251e56e86d261f24cd209ded2946.tar.gz emacs-59a84f8e16e2251e56e86d261f24cd209ded2946.zip | |
(echo_message_buffer): New variable.
(echo_now): Set echo_message_buffer to the echo area buffer used
to display the echo.
(cancel_echoing): Reset echo_message_buffer to nil.
(read_char): Code rewritten that handles canceling an echo or
echoing a dash, respectively.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 9409b63242e..5ccdf319fc7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -203,13 +203,18 @@ static int echoing; | |||
| 203 | 203 | ||
| 204 | static struct kboard *ok_to_echo_at_next_pause; | 204 | static struct kboard *ok_to_echo_at_next_pause; |
| 205 | 205 | ||
| 206 | /* The kboard currently echoing, or null for none. Set in echo_now to | 206 | /* The kboard last echoing, or null for none. Reset to 0 in |
| 207 | the kboard echoing. Reset to 0 in cancel_echoing. If non-null, | 207 | cancel_echoing. If non-null, and a current echo area message |
| 208 | and a current echo area message exists, we know that it comes from | 208 | exists, and echo_message_buffer is eq to the current message |
| 209 | echoing. */ | 209 | buffer, we know that the message comes from echo_kboard. */ |
| 210 | 210 | ||
| 211 | static struct kboard *echo_kboard; | 211 | static struct kboard *echo_kboard; |
| 212 | 212 | ||
| 213 | /* The buffer used for echoing. Set in echo_now, reset in | ||
| 214 | cancel_echoing. */ | ||
| 215 | |||
| 216 | static Lisp_Object echo_message_buffer; | ||
| 217 | |||
| 213 | /* Nonzero means disregard local maps for the menu bar. */ | 218 | /* Nonzero means disregard local maps for the menu bar. */ |
| 214 | static int inhibit_local_menu_bar_menus; | 219 | static int inhibit_local_menu_bar_menus; |
| 215 | 220 | ||
| @@ -770,11 +775,14 @@ echo_now () | |||
| 770 | } | 775 | } |
| 771 | 776 | ||
| 772 | echoing = 1; | 777 | echoing = 1; |
| 773 | echo_kboard = current_kboard; | ||
| 774 | message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf), | 778 | message2_nolog (current_kboard->echobuf, strlen (current_kboard->echobuf), |
| 775 | ! NILP (current_buffer->enable_multibyte_characters)); | 779 | ! NILP (current_buffer->enable_multibyte_characters)); |
| 776 | echoing = 0; | 780 | echoing = 0; |
| 777 | 781 | ||
| 782 | /* Record in what buffer we echoed, and from which kboard. */ | ||
| 783 | echo_message_buffer = echo_area_buffer[0]; | ||
| 784 | echo_kboard = current_kboard; | ||
| 785 | |||
| 778 | if (waiting_for_input && !NILP (Vquit_flag)) | 786 | if (waiting_for_input && !NILP (Vquit_flag)) |
| 779 | quit_throw_to_read_char (); | 787 | quit_throw_to_read_char (); |
| 780 | } | 788 | } |
| @@ -787,8 +795,9 @@ cancel_echoing () | |||
| 787 | current_kboard->immediate_echo = 0; | 795 | current_kboard->immediate_echo = 0; |
| 788 | current_kboard->echoptr = current_kboard->echobuf; | 796 | current_kboard->echoptr = current_kboard->echobuf; |
| 789 | current_kboard->echo_after_prompt = -1; | 797 | current_kboard->echo_after_prompt = -1; |
| 790 | ok_to_echo_at_next_pause = 0; | 798 | ok_to_echo_at_next_pause = NULL; |
| 791 | echo_kboard = 0; | 799 | echo_kboard = NULL; |
| 800 | echo_message_buffer = Qnil; | ||
| 792 | } | 801 | } |
| 793 | 802 | ||
| 794 | /* Return the length of the current echo string. */ | 803 | /* Return the length of the current echo string. */ |
| @@ -2078,19 +2087,43 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2078 | } | 2087 | } |
| 2079 | } | 2088 | } |
| 2080 | 2089 | ||
| 2081 | /* Message turns off echoing unless more keystrokes turn it on again. */ | 2090 | /* Message turns off echoing unless more keystrokes turn it on again. |
| 2082 | if (/* There is a current message. */ | 2091 | |
| 2092 | The code in 20.x for the condition was | ||
| 2093 | |||
| 2094 | 1. echo_area_glyphs && *echo_area_glyphs | ||
| 2095 | 2. && echo_area_glyphs != current_kboard->echobuf | ||
| 2096 | 3. && ok_to_echo_at_next_pause != echo_area_glyphs | ||
| 2097 | |||
| 2098 | (1) means there's a current message displayed | ||
| 2099 | |||
| 2100 | (2) means it's not the message from echoing from the current | ||
| 2101 | kboard. | ||
| 2102 | |||
| 2103 | (3) There's only one place in 20.x where ok_to_echo_at_next_pause | ||
| 2104 | is set to a non-null value. This is done in read_char and it is | ||
| 2105 | set to echo_area_glyphs after a call to echo_char. That means | ||
| 2106 | ok_to_echo_at_next_pause is either null or | ||
| 2107 | current_kboard->echobuf with the appropriate current_kboard at | ||
| 2108 | that time. | ||
| 2109 | |||
| 2110 | So, condition (3) means in clear text ok_to_echo_at_next_pause | ||
| 2111 | must be either null, or the current message isn't from echoing at | ||
| 2112 | all, or it's from echoing from a different kboard than the | ||
| 2113 | current one. */ | ||
| 2114 | |||
| 2115 | if (/* There currently something in the echo area */ | ||
| 2083 | !NILP (echo_area_buffer[0]) | 2116 | !NILP (echo_area_buffer[0]) |
| 2084 | /* And we're not echoing from this kboard. */ | 2117 | && (/* And it's either not from echoing. */ |
| 2085 | && echo_kboard != current_kboard | 2118 | !EQ (echo_area_buffer[0], echo_message_buffer) |
| 2086 | /* And it's either not ok to echo (ok_to_echo == NULL), or the | 2119 | /* Or it's an echo from a different kboard. */ |
| 2087 | last char echoed was from a different kboard. */ | 2120 | || echo_kboard != current_kboard |
| 2088 | && ok_to_echo_at_next_pause != echo_kboard) | 2121 | /* Or we explicitly allow overwriting whatever there is. */ |
| 2122 | || ok_to_echo_at_next_pause == NULL)) | ||
| 2089 | cancel_echoing (); | 2123 | cancel_echoing (); |
| 2090 | else | 2124 | else |
| 2091 | /* If already echoing, continue. */ | ||
| 2092 | echo_dash (); | 2125 | echo_dash (); |
| 2093 | 2126 | ||
| 2094 | /* Try reading a character via menu prompting in the minibuf. | 2127 | /* Try reading a character via menu prompting in the minibuf. |
| 2095 | Try this before the sit-for, because the sit-for | 2128 | Try this before the sit-for, because the sit-for |
| 2096 | would do the wrong thing if we are supposed to do | 2129 | would do the wrong thing if we are supposed to do |