comparison src/buffer.c @ 25368:f9949db6ca7d

(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.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 23 Aug 1999 00:11:36 +0000
parents c7247eabc834
children 0359edc6e428
comparison
equal deleted inserted replaced
25367:823e14641544 25368:f9949db6ca7d
362 BUF_Z_BYTE (b) = 1; 362 BUF_Z_BYTE (b) = 1;
363 BUF_MODIFF (b) = 1; 363 BUF_MODIFF (b) = 1;
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;
376 all_buffers = b; 381 all_buffers = b;
377 382
519 b->directory = (current_buffer) ? current_buffer->directory : Qnil; 524 b->directory = (current_buffer) ? current_buffer->directory : Qnil;
520 b->modtime = 0; 525 b->modtime = 0;
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;
528 b->auto_save_file_name = Qnil; 534 b->auto_save_file_name = Qnil;
529 b->read_only = Qnil; 535 b->read_only = Qnil;
1428 1434
1429 void 1435 void
1430 set_buffer_internal (b) 1436 set_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.
1446 This is used by redisplay. */ 1459 This is used by redisplay. */
1447 1460
3087 3100
3088 /* If this is a buffer not in the selected window, 3101 /* If this is a buffer not in the selected window,
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 }
3117 3113
3118 3114