diff options
| author | Richard M. Stallman | 2001-11-18 06:54:50 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-11-18 06:54:50 +0000 |
| commit | b14bc55ea70194ae36683c52988802f2802e0d79 (patch) | |
| tree | 23b17dd7bf5e80a6eb5f804532ebaeb5aea6dc43 | |
| parent | b5a4bb222b620f24a43e6ef1559b710d563f0e5a (diff) | |
| download | emacs-b14bc55ea70194ae36683c52988802f2802e0d79.tar.gz emacs-b14bc55ea70194ae36683c52988802f2802e0d79.zip | |
(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.
| -rw-r--r-- | src/xdisp.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 332c11c974e..d2ebae8f006 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -291,6 +291,12 @@ int noninteractive_need_newline; | |||
| 291 | 291 | ||
| 292 | static int message_log_need_newline; | 292 | static int message_log_need_newline; |
| 293 | 293 | ||
| 294 | /* Three markers that message_dolog uses. | ||
| 295 | It could allocate them itself, but that causes trouble | ||
| 296 | in handling memory-full errors. */ | ||
| 297 | static Lisp_Object message_dolog_marker1; | ||
| 298 | static Lisp_Object message_dolog_marker2; | ||
| 299 | static Lisp_Object message_dolog_marker3; | ||
| 294 | 300 | ||
| 295 | /* The buffer position of the first character appearing entirely or | 301 | /* The buffer position of the first character appearing entirely or |
| 296 | partially on the line of the selected window which contains the | 302 | partially on the line of the selected window which contains the |
| @@ -5616,10 +5622,13 @@ message_dolog (m, nbytes, nlflag, multibyte) | |||
| 5616 | Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); | 5622 | Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); |
| 5617 | current_buffer->undo_list = Qt; | 5623 | current_buffer->undo_list = Qt; |
| 5618 | 5624 | ||
| 5619 | oldpoint = Fpoint_marker (); | 5625 | oldpoint = message_dolog_marker1; |
| 5620 | oldbegv = Fpoint_min_marker (); | 5626 | set_marker_restricted (oldpoint, make_number (PT), Qnil); |
| 5621 | oldzv = Fpoint_max_marker (); | 5627 | oldbegv = message_dolog_marker2; |
| 5622 | GCPRO4 (oldpoint, oldbegv, oldzv, old_deactivate_mark); | 5628 | set_marker_restricted (oldbegv, make_number (BEGV), Qnil); |
| 5629 | oldzv = message_dolog_marker3; | ||
| 5630 | set_marker_restricted (oldzv, make_number (ZV), Qnil); | ||
| 5631 | GCPRO1 (old_deactivate_mark); | ||
| 5623 | 5632 | ||
| 5624 | if (PT == Z) | 5633 | if (PT == Z) |
| 5625 | point_at_end = 1; | 5634 | point_at_end = 1; |
| @@ -5678,6 +5687,8 @@ message_dolog (m, nbytes, nlflag, multibyte) | |||
| 5678 | this_bol = PT; | 5687 | this_bol = PT; |
| 5679 | this_bol_byte = PT_BYTE; | 5688 | this_bol_byte = PT_BYTE; |
| 5680 | 5689 | ||
| 5690 | /* See if this line duplicates the previous one. | ||
| 5691 | If so, combine duplicates. */ | ||
| 5681 | if (this_bol > BEG) | 5692 | if (this_bol > BEG) |
| 5682 | { | 5693 | { |
| 5683 | scan_newline (PT, PT_BYTE, BEG, BEG_BYTE, -2, 0); | 5694 | scan_newline (PT, PT_BYTE, BEG, BEG_BYTE, -2, 0); |
| @@ -5705,6 +5716,10 @@ message_dolog (m, nbytes, nlflag, multibyte) | |||
| 5705 | } | 5716 | } |
| 5706 | } | 5717 | } |
| 5707 | 5718 | ||
| 5719 | /* If we have more than the desired maximum number of lines | ||
| 5720 | in the *Messages* buffer now, delete the oldest ones. | ||
| 5721 | This is safe because we don't have undo in this buffer. */ | ||
| 5722 | |||
| 5708 | if (NATNUMP (Vmessage_log_max)) | 5723 | if (NATNUMP (Vmessage_log_max)) |
| 5709 | { | 5724 | { |
| 5710 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, | 5725 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, |
| @@ -5735,9 +5750,9 @@ message_dolog (m, nbytes, nlflag, multibyte) | |||
| 5735 | XMARKER (oldpoint)->bytepos); | 5750 | XMARKER (oldpoint)->bytepos); |
| 5736 | 5751 | ||
| 5737 | UNGCPRO; | 5752 | UNGCPRO; |
| 5738 | free_marker (oldpoint); | 5753 | unchain_marker (oldpoint); |
| 5739 | free_marker (oldbegv); | 5754 | unchain_marker (oldbegv); |
| 5740 | free_marker (oldzv); | 5755 | unchain_marker (oldzv); |
| 5741 | 5756 | ||
| 5742 | tem = Fget_buffer_window (Fcurrent_buffer (), Qt); | 5757 | tem = Fget_buffer_window (Fcurrent_buffer (), Qt); |
| 5743 | set_buffer_internal (oldbuf); | 5758 | set_buffer_internal (oldbuf); |
| @@ -14590,6 +14605,13 @@ syms_of_xdisp () | |||
| 14590 | Qinhibit_redisplay = intern ("inhibit-redisplay"); | 14605 | Qinhibit_redisplay = intern ("inhibit-redisplay"); |
| 14591 | staticpro (&Qinhibit_redisplay); | 14606 | staticpro (&Qinhibit_redisplay); |
| 14592 | 14607 | ||
| 14608 | message_dolog_marker1 = Fmake_marker (); | ||
| 14609 | staticpro (&message_dolog_marker1); | ||
| 14610 | message_dolog_marker2 = Fmake_marker (); | ||
| 14611 | staticpro (&message_dolog_marker2); | ||
| 14612 | message_dolog_marker3 = Fmake_marker (); | ||
| 14613 | staticpro (&message_dolog_marker3); | ||
| 14614 | |||
| 14593 | #if GLYPH_DEBUG | 14615 | #if GLYPH_DEBUG |
| 14594 | defsubr (&Sdump_glyph_matrix); | 14616 | defsubr (&Sdump_glyph_matrix); |
| 14595 | defsubr (&Sdump_glyph_row); | 14617 | defsubr (&Sdump_glyph_row); |