aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorGerd Moellmann1999-08-23 00:11:36 +0000
committerGerd Moellmann1999-08-23 00:11:36 +0000
commitb5a225b4949590401fd8a0b9c4d4117ad33e691d (patch)
tree90c8c6fccb835f1afa974fc8e208b5a9df67865a /src/buffer.c
parent3770920e08dcd4bf5a23ab07473f85a3dcf320aa (diff)
downloademacs-b5a225b4949590401fd8a0b9c4d4117ad33e691d.tar.gz
emacs-b5a225b4949590401fd8a0b9c4d4117ad33e691d.zip
(set_buffer_internal): Set windows_or_buffers_changed
only if buffer is displayed somewhere. (modify_overlay): Use BUF_COMPUTE_UNCHANGED. (reset_buffer): Set clip_changed to 0 and prevent_redisplay_optimizations_p to 1. (Fget_buffer_create): Set prevent_redisplay_optimizations_p to 1. (modify_overlay): Compute beg/end_unchanged per buffer. (Fget_buffer_create): Initialize new members of the buffer structure.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c54
1 files changed, 25 insertions, 29 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 8aa19381983..da88e85f23b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -364,12 +364,17 @@ The value is never nil.")
364 BUF_OVERLAY_MODIFF (b) = 1; 364 BUF_OVERLAY_MODIFF (b) = 1;
365 BUF_SAVE_MODIFF (b) = 1; 365 BUF_SAVE_MODIFF (b) = 1;
366 BUF_INTERVALS (b) = 0; 366 BUF_INTERVALS (b) = 0;
367 BUF_UNCHANGED_MODIFIED (b) = 1;
368 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
369 BUF_END_UNCHANGED (b) = 0;
370 BUF_BEG_UNCHANGED (b) = 0;
367 *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ 371 *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */
368 372
369 b->newline_cache = 0; 373 b->newline_cache = 0;
370 b->width_run_cache = 0; 374 b->width_run_cache = 0;
371 b->width_table = Qnil; 375 b->width_table = Qnil;
372 b->minibuffer_prompt_length = Qnil; 376 b->minibuffer_prompt_length = Qnil;
377 b->prevent_redisplay_optimizations_p = 1;
373 378
374 /* Put this on the chain of all buffers including killed ones. */ 379 /* Put this on the chain of all buffers including killed ones. */
375 b->next = all_buffers; 380 b->next = all_buffers;
@@ -521,7 +526,8 @@ reset_buffer (b)
521 XSETFASTINT (b->save_length, 0); 526 XSETFASTINT (b->save_length, 0);
522 b->last_window_start = 1; 527 b->last_window_start = 1;
523 /* It is more conservative to start out "changed" than "unchanged". */ 528 /* It is more conservative to start out "changed" than "unchanged". */
524 b->clip_changed = 1; 529 b->clip_changed = 0;
530 b->prevent_redisplay_optimizations_p = 1;
525 b->backed_up = Qnil; 531 b->backed_up = Qnil;
526 b->auto_save_modified = 0; 532 b->auto_save_modified = 0;
527 b->auto_save_failure_time = -1; 533 b->auto_save_failure_time = -1;
@@ -1430,16 +1436,23 @@ void
1430set_buffer_internal (b) 1436set_buffer_internal (b)
1431 register struct buffer *b; 1437 register struct buffer *b;
1432{ 1438{
1433 register struct buffer *old_buf; 1439 if (current_buffer != b)
1434 register Lisp_Object tail, valcontents; 1440 {
1435 Lisp_Object tem; 1441 /* Set windows_or_buffers_changed only if buffer is displayed
1436 1442 somewhere. This enables redisplay optimizations if a
1437 if (current_buffer == b) 1443 background task like deferred fontification changes buffers,
1438 return; 1444 but none that are currently displayed. */
1439 1445 if (!windows_or_buffers_changed
1440 /* Otherwise, force-mode-line-update doesn't work as expected. */ 1446 && selected_frame)
1441 windows_or_buffers_changed = 1; 1447 {
1442 set_buffer_internal_1 (b); 1448 Lisp_Object buffer;
1449 XSETBUFFER (buffer, b);
1450 if (!NILP (Fget_buffer_window (buffer, Qvisible)))
1451 ++windows_or_buffers_changed;
1452 }
1453
1454 set_buffer_internal_1 (b);
1455 }
1443} 1456}
1444 1457
1445/* Set the current buffer to B, and do not set windows_or_buffers_changed. 1458/* Set the current buffer to B, and do not set windows_or_buffers_changed.
@@ -3089,28 +3102,11 @@ modify_overlay (buf, start, end)
3089 we must do other windows. */ 3102 we must do other windows. */
3090 if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) 3103 if (buf != XBUFFER (XWINDOW (selected_window)->buffer))
3091 windows_or_buffers_changed = 1; 3104 windows_or_buffers_changed = 1;
3092 /* If it's not current, we can't use beg_unchanged, end_unchanged for it. */
3093 else if (buf != current_buffer)
3094 windows_or_buffers_changed = 1;
3095 /* If multiple windows show this buffer, we must do other windows. */ 3105 /* If multiple windows show this buffer, we must do other windows. */
3096 else if (buffer_shared > 1) 3106 else if (buffer_shared > 1)
3097 windows_or_buffers_changed = 1; 3107 windows_or_buffers_changed = 1;
3098 else 3108 else
3099 { 3109 BUF_COMPUTE_UNCHANGED (buf, start, end);
3100 if (unchanged_modified == MODIFF
3101 && overlay_unchanged_modified == OVERLAY_MODIFF)
3102 {
3103 beg_unchanged = start - BEG;
3104 end_unchanged = Z - end;
3105 }
3106 else
3107 {
3108 if (Z - end < end_unchanged)
3109 end_unchanged = Z - end;
3110 if (start - BEG < beg_unchanged)
3111 beg_unchanged = start - BEG;
3112 }
3113 }
3114 3110
3115 ++BUF_OVERLAY_MODIFF (buf); 3111 ++BUF_OVERLAY_MODIFF (buf);
3116} 3112}