aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1995-01-11 01:55:01 +0000
committerKarl Heuer1995-01-11 01:55:01 +0000
commit5992c4f72579c591ae862735bb237ebd88439c15 (patch)
tree1abee107f941ddfc0b6a86f90ba5bb69ba4be502 /src
parentb718c3954042f160f9006451f922dd831cdb9b62 (diff)
downloademacs-5992c4f72579c591ae862735bb237ebd88439c15.tar.gz
emacs-5992c4f72579c591ae862735bb237ebd88439c15.zip
(Vmessage_log_max): New var.
(syms_of_xdisp): defvar and initialize it. (message2_nolog): Renamed from message2. (message2): Log messages, then call message2_nolog.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 1b2324c1320..2647f178e76 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,5 +1,5 @@
1/* Display generation from window structure and buffer text. 1/* Display generation from window structure and buffer text.
2 Copyright (C) 1985, 86, 87, 88, 93, 94 Free Software Foundation, Inc. 2 Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -206,6 +206,10 @@ int column_number_displayed;
206 206
207/* Maximum buffer size for which to display line numbers. */ 207/* Maximum buffer size for which to display line numbers. */
208int line_number_display_limit; 208int line_number_display_limit;
209
210/* Number of lines to keep in the message log buffer.
211 t means infinite. nil means don't log at all. */
212Lisp_Object Vmessage_log_max;
209 213
210/* Display an echo area message M with a specified length of LEN chars. 214/* Display an echo area message M with a specified length of LEN chars.
211 The string may include null characters. If m is 0, clear out any 215 The string may include null characters. If m is 0, clear out any
@@ -217,6 +221,49 @@ message2 (m, len)
217 char *m; 221 char *m;
218 int len; 222 int len;
219{ 223{
224 if (m && !NILP (Vmessage_log_max))
225 {
226 struct buffer *oldbuf;
227 int oldpoint, oldbegv, oldzv;
228
229 oldbuf = current_buffer;
230 Fset_buffer (Fget_buffer_create (build_string (" *Messages*")));
231 oldpoint = PT;
232 oldbegv = BEGV;
233 oldzv = ZV;
234 if (oldpoint == Z)
235 oldpoint += len + 1;
236 if (oldzv == Z)
237 oldzv += len + 1;
238 TEMP_SET_PT (Z);
239 insert_1 (m, len, 1, 0);
240 insert_1 ("\n", 1, 1, 0);
241 if (NATNUMP (Vmessage_log_max))
242 {
243 Lisp_Object n;
244 XSETINT (n, -XFASTINT (Vmessage_log_max));
245 Fforward_line (n);
246 oldpoint -= min (PT, oldpoint) - BEG;
247 oldbegv -= min (PT, oldbegv) - BEG;
248 oldzv -= min (PT, oldzv) - BEG;
249 del_range (BEG, PT);
250 }
251 BEGV = oldbegv;
252 ZV = oldzv;
253 TEMP_SET_PT (oldpoint);
254 set_buffer_internal (oldbuf);
255 }
256 message2_nolog (m, len);
257}
258
259
260/* The non-logging part of that function. */
261
262void
263message2_nolog (m, len)
264 char *m;
265 int len;
266{
220 if (noninteractive) 267 if (noninteractive)
221 { 268 {
222 if (noninteractive_need_newline) 269 if (noninteractive_need_newline)
@@ -3668,6 +3715,12 @@ and is used only on frames for which no explicit name has been set\n\
3668 Fcons (intern ("system-name"), 3715 Fcons (intern ("system-name"),
3669 Qnil)))), 3716 Qnil)))),
3670 Qnil))); 3717 Qnil)));
3718
3719 DEFVAR_LISP ("message-log-max", &Vmessage_log_max,
3720 "Maximum number of lines to keep in the message log buffer.\n\
3721If nil, disable message logging. If t, log messages but don't truncate\n\
3722the buffer when it becomes large.");
3723 XSETFASTINT (Vmessage_log_max, 50);
3671} 3724}
3672 3725
3673/* initialize the window system */ 3726/* initialize the window system */