Commit b14bc55e authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(message_dolog_marker1, message_dolog_marker2)

(message_dolog_marker3): New static variables hold three markers.
(syms_of_xdisp): Initialize and staticpro them.
(message_dolog): Use message_dolog_marker1..3 instead of
allocating markers each time.  Unchain them when done.
parent b5a4bb22
......@@ -291,6 +291,12 @@ int noninteractive_need_newline;
static int message_log_need_newline;
/* Three markers that message_dolog uses.
It could allocate them itself, but that causes trouble
in handling memory-full errors. */
static Lisp_Object message_dolog_marker1;
static Lisp_Object message_dolog_marker2;
static Lisp_Object message_dolog_marker3;
/* The buffer position of the first character appearing entirely or
partially on the line of the selected window which contains the
......@@ -5616,10 +5622,13 @@ message_dolog (m, nbytes, nlflag, multibyte)
Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
current_buffer->undo_list = Qt;
oldpoint = Fpoint_marker ();
oldbegv = Fpoint_min_marker ();
oldzv = Fpoint_max_marker ();
GCPRO4 (oldpoint, oldbegv, oldzv, old_deactivate_mark);
oldpoint = message_dolog_marker1;
set_marker_restricted (oldpoint, make_number (PT), Qnil);
oldbegv = message_dolog_marker2;
set_marker_restricted (oldbegv, make_number (BEGV), Qnil);
oldzv = message_dolog_marker3;
set_marker_restricted (oldzv, make_number (ZV), Qnil);
GCPRO1 (old_deactivate_mark);
if (PT == Z)
point_at_end = 1;
......@@ -5678,6 +5687,8 @@ message_dolog (m, nbytes, nlflag, multibyte)
this_bol = PT;
this_bol_byte = PT_BYTE;
/* See if this line duplicates the previous one.
If so, combine duplicates. */
if (this_bol > BEG)
scan_newline (PT, PT_BYTE, BEG, BEG_BYTE, -2, 0);
......@@ -5705,6 +5716,10 @@ message_dolog (m, nbytes, nlflag, multibyte)
/* If we have more than the desired maximum number of lines
in the *Messages* buffer now, delete the oldest ones.
This is safe because we don't have undo in this buffer. */
if (NATNUMP (Vmessage_log_max))
scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
......@@ -5735,9 +5750,9 @@ message_dolog (m, nbytes, nlflag, multibyte)
XMARKER (oldpoint)->bytepos);
free_marker (oldpoint);
free_marker (oldbegv);
free_marker (oldzv);
unchain_marker (oldpoint);
unchain_marker (oldbegv);
unchain_marker (oldzv);
tem = Fget_buffer_window (Fcurrent_buffer (), Qt);
set_buffer_internal (oldbuf);
......@@ -14590,6 +14605,13 @@ syms_of_xdisp ()
Qinhibit_redisplay = intern ("inhibit-redisplay");
staticpro (&Qinhibit_redisplay);
message_dolog_marker1 = Fmake_marker ();
staticpro (&message_dolog_marker1);
message_dolog_marker2 = Fmake_marker ();
staticpro (&message_dolog_marker2);
message_dolog_marker3 = Fmake_marker ();
staticpro (&message_dolog_marker3);
defsubr (&Sdump_glyph_matrix);
defsubr (&Sdump_glyph_row);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment