comparison src/xdisp.c @ 10416:51c4308d74c9

(message_log_need_newline): New var. (message_dolog): New function, extracted from message2.
author Karl Heuer <kwzh@gnu.org>
date Fri, 13 Jan 1995 02:22:14 +0000
parents afa796e2b954
children f1fc7b6e5fa4
comparison
equal deleted inserted replaced
10415:72031f772d96 10416:51c4308d74c9
42 extern int interrupt_input; 42 extern int interrupt_input;
43 extern int command_loop_level; 43 extern int command_loop_level;
44 44
45 extern Lisp_Object Qface; 45 extern Lisp_Object Qface;
46 46
47 /* Nonzero means print newline before next minibuffer message. */ 47 /* Nonzero means print newline to stdout before next minibuffer message. */
48 48
49 int noninteractive_need_newline; 49 int noninteractive_need_newline;
50
51 /* Nonzero means print newline to message log before next message. */
52
53 int message_log_need_newline;
50 54
51 #define min(a, b) ((a) < (b) ? (a) : (b)) 55 #define min(a, b) ((a) < (b) ? (a) : (b))
52 #define max(a, b) ((a) > (b) ? (a) : (b)) 56 #define max(a, b) ((a) > (b) ? (a) : (b))
53 57
54 /* The buffer position of the first character appearing 58 /* The buffer position of the first character appearing
209 213
210 /* Number of lines to keep in the message log buffer. 214 /* Number of lines to keep in the message log buffer.
211 t means infinite. nil means don't log at all. */ 215 t means infinite. nil means don't log at all. */
212 Lisp_Object Vmessage_log_max; 216 Lisp_Object Vmessage_log_max;
213 217
214 /* Display an echo area message M with a specified length of LEN chars. 218 /* Add a string to the message log, optionally terminated with a newline. */
215 The string may include null characters. If m is 0, clear out any
216 existing message, and let the minibuffer text show through.
217 Do not pass text that is stored in a Lisp string. */
218 219
219 void 220 void
220 message2 (m, len) 221 message_dolog (m, len, nlflag)
221 char *m; 222 char *m;
222 int len; 223 int len, nlflag;
223 { 224 {
224 if (m && !NILP (Vmessage_log_max)) 225 if (!NILP (Vmessage_log_max))
225 { 226 {
226 struct buffer *oldbuf; 227 struct buffer *oldbuf;
227 int oldpoint, oldbegv, oldzv; 228 int oldpoint, oldbegv, oldzv;
228 229
229 oldbuf = current_buffer; 230 oldbuf = current_buffer;
230 Fset_buffer (Fget_buffer_create (build_string (" *Messages*"))); 231 Fset_buffer (Fget_buffer_create (build_string (" *Messages*")));
231 oldpoint = PT; 232 oldpoint = PT;
232 oldbegv = BEGV; 233 oldbegv = BEGV;
233 oldzv = ZV; 234 oldzv = ZV;
234 if (oldpoint == Z) 235 if (oldpoint == Z)
235 oldpoint += len + 1; 236 oldpoint += len + nlflag;
236 if (oldzv == Z) 237 if (oldzv == Z)
237 oldzv += len + 1; 238 oldzv += len + nlflag;
238 TEMP_SET_PT (Z); 239 TEMP_SET_PT (Z);
239 insert_1 (m, len, 1, 0); 240 if (len)
240 insert_1 ("\n", 1, 1, 0); 241 insert_1 (m, len, 1, 0);
242 if (nlflag)
243 insert_1 ("\n", 1, 1, 0);
241 if (NATNUMP (Vmessage_log_max)) 244 if (NATNUMP (Vmessage_log_max))
242 { 245 {
243 Lisp_Object n; 246 Lisp_Object n;
244 XSETINT (n, -XFASTINT (Vmessage_log_max)); 247 XSETINT (n, -XFASTINT (Vmessage_log_max));
245 Fforward_line (n); 248 Fforward_line (n);
251 BEGV = oldbegv; 254 BEGV = oldbegv;
252 ZV = oldzv; 255 ZV = oldzv;
253 TEMP_SET_PT (oldpoint); 256 TEMP_SET_PT (oldpoint);
254 set_buffer_internal (oldbuf); 257 set_buffer_internal (oldbuf);
255 } 258 }
259 }
260
261
262 /* Display an echo area message M with a specified length of LEN chars.
263 The string may include null characters. If m is 0, clear out any
264 existing message, and let the minibuffer text show through.
265 Do not pass text that is stored in a Lisp string. */
266
267 void
268 message2 (m, len)
269 char *m;
270 int len;
271 {
272 /* First flush out any partial line written with print. */
273 if (message_log_need_newline)
274 message_dolog ("", 0, 1);
275 message_log_need_newline = 0;
276 if (m)
277 message_dolog (m, len, 1);
256 message2_nolog (m, len); 278 message2_nolog (m, len);
257 } 279 }
258 280
259 281
260 /* The non-logging part of that function. */ 282 /* The non-logging part of that function. */