comparison src/buffer.c @ 39333:7af35736264f

(modify_overlay): Don't do nothing if START == END; This can still be a modification, for example when an overlay has a before-string or after-string. (Fdelete_overlay): Prevent redisplay optimizations when deleting an overlay with before-string or after-string.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 18 Sep 2001 12:20:53 +0000
parents 7eeeae13a5ef
children b20b329387f5
comparison
equal deleted inserted replaced
39332:4f1342b70a04 39333:7af35736264f
178 Lisp_Object Qinsert_behind_hooks; 178 Lisp_Object Qinsert_behind_hooks;
179 179
180 static void alloc_buffer_text P_ ((struct buffer *, size_t)); 180 static void alloc_buffer_text P_ ((struct buffer *, size_t));
181 static void free_buffer_text P_ ((struct buffer *b)); 181 static void free_buffer_text P_ ((struct buffer *b));
182 static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object)); 182 static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object));
183 static void modify_overlay P_ ((struct buffer *, int, int));
183 184
184 185
185 /* For debugging; temporary. See set_buffer_internal. */ 186 /* For debugging; temporary. See set_buffer_internal. */
186 /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ 187 /* Lisp_Object Qlisp_mode, Vcheck_symbol; */
187 188
3400 static void 3401 static void
3401 modify_overlay (buf, start, end) 3402 modify_overlay (buf, start, end)
3402 struct buffer *buf; 3403 struct buffer *buf;
3403 int start, end; 3404 int start, end;
3404 { 3405 {
3405 if (start == end)
3406 return;
3407
3408 if (start > end) 3406 if (start > end)
3409 { 3407 {
3410 int temp = start; 3408 int temp = start;
3411 start = end; end = temp; 3409 start = end;
3410 end = temp;
3412 } 3411 }
3413 3412
3414 BUF_COMPUTE_UNCHANGED (buf, start, end); 3413 BUF_COMPUTE_UNCHANGED (buf, start, end);
3415 3414
3416 /* If this is a buffer not in the selected window, 3415 /* If this is a buffer not in the selected window,
3545 buffer = Fmarker_buffer (OVERLAY_START (overlay)); 3544 buffer = Fmarker_buffer (OVERLAY_START (overlay));
3546 if (NILP (buffer)) 3545 if (NILP (buffer))
3547 return Qnil; 3546 return Qnil;
3548 3547
3549 b = XBUFFER (buffer); 3548 b = XBUFFER (buffer);
3550
3551 specbind (Qinhibit_quit, Qt); 3549 specbind (Qinhibit_quit, Qt);
3552 3550
3553 b->overlays_before = Fdelq (overlay, b->overlays_before); 3551 b->overlays_before = Fdelq (overlay, b->overlays_before);
3554 b->overlays_after = Fdelq (overlay, b->overlays_after); 3552 b->overlays_after = Fdelq (overlay, b->overlays_after);
3555
3556 modify_overlay (b, 3553 modify_overlay (b,
3557 marker_position (OVERLAY_START (overlay)), 3554 marker_position (OVERLAY_START (overlay)),
3558 marker_position (OVERLAY_END (overlay))); 3555 marker_position (OVERLAY_END (overlay)));
3559
3560 Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); 3556 Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
3561 Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); 3557 Fset_marker (OVERLAY_END (overlay), Qnil, Qnil);
3558
3559 /* WHen deleting on overlay with before or after strings, turn off
3560 display optimizations for the affected buffer, on the basis that
3561 these strings may contain newlines. This is easier to do than to
3562 check for that situation during redisplay. */
3563 if (!windows_or_buffers_changed
3564 && (!NILP (Foverlay_get (overlay, Qbefore_string))
3565 || !NILP (Foverlay_get (overlay, Qafter_string))))
3566 b->prevent_redisplay_optimizations_p = 1;
3562 3567
3563 return unbind_to (count, Qnil); 3568 return unbind_to (count, Qnil);
3564 } 3569 }
3565 3570
3566 /* Overlay dissection functions. */ 3571 /* Overlay dissection functions. */
3831 found: 3836 found:
3832 if (! NILP (buffer)) 3837 if (! NILP (buffer))
3833 { 3838 {
3834 if (changed) 3839 if (changed)
3835 modify_overlay (XBUFFER (buffer), 3840 modify_overlay (XBUFFER (buffer),
3836 marker_position (OVERLAY_START (overlay)), 3841 marker_position (OVERLAY_START (overlay)),
3837 marker_position (OVERLAY_END (overlay))); 3842 marker_position (OVERLAY_END (overlay)));
3838 if (EQ (prop, Qevaporate) && ! NILP (value) 3843 if (EQ (prop, Qevaporate) && ! NILP (value)
3839 && (OVERLAY_POSITION (OVERLAY_START (overlay)) 3844 && (OVERLAY_POSITION (OVERLAY_START (overlay))
3840 == OVERLAY_POSITION (OVERLAY_END (overlay)))) 3845 == OVERLAY_POSITION (OVERLAY_END (overlay))))
3841 Fdelete_overlay (overlay); 3846 Fdelete_overlay (overlay);
3842 } 3847 }