Mercurial > emacs
comparison src/keyboard.c @ 28672:4cb794d0027e
(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.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 20 Apr 2000 21:00:43 +0000 |
parents | b6f06a755c7d |
children | ab98f4a8d7e1 |
comparison
equal
deleted
inserted
replaced
28671:678e1643ac82 | 28672:4cb794d0027e |
---|---|
201 /* Non-null means we can start echoing at the next input pause even | 201 /* Non-null means we can start echoing at the next input pause even |
202 though there is something in the echo area. */ | 202 though there is something in the echo area. */ |
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 | |
213 /* The buffer used for echoing. Set in echo_now, reset in | |
214 cancel_echoing. */ | |
215 | |
216 static Lisp_Object echo_message_buffer; | |
212 | 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 |
216 /* Nonzero means C-g should cause immediate error-signal. */ | 221 /* Nonzero means C-g should cause immediate error-signal. */ |
768 } | 773 } |
769 echo_dash (); | 774 echo_dash (); |
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 } |
781 | 789 |
782 /* Turn off echoing, for the start of a new command. */ | 790 /* Turn off echoing, for the start of a new command. */ |
785 cancel_echoing () | 793 cancel_echoing () |
786 { | 794 { |
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. */ |
795 | 804 |
796 static int | 805 static int |
2076 swallow_events (0); | 2085 swallow_events (0); |
2077 /* If that cleared input_pending, try again to redisplay. */ | 2086 /* If that cleared input_pending, try again to redisplay. */ |
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 |
2097 menu prompting. If EVENT_HAS_PARAMETERS then we are reading | 2130 menu prompting. If EVENT_HAS_PARAMETERS then we are reading |
2098 after a mouse event so don't try a minibuf menu. */ | 2131 after a mouse event so don't try a minibuf menu. */ |