{
Lisp_Object prop, overlay, tail;
int insertion = EQ (start, end);
+ int tail_copied;
+ struct gcpro gcpro1, gcpro2;
+
+ overlay = Qnil;
+ tail = Qnil;
+ GCPRO2 (overlay, tail);
+ tail_copied = 0;
for (tail = current_buffer->overlays_before;
CONSP (tail);
tail = XCONS (tail)->cdr)
if (!NILP (prop))
{
/* Copy TAIL in case the hook recenters the overlay lists. */
- tail = Fcopy_sequence (tail);
+ if (!tail_copied)
+ tail = Fcopy_sequence (tail);
+ tail_copied = 1;
call_overlay_mod_hooks (prop, overlay, start, end);
}
}
prop = Foverlay_get (overlay, Qinsert_behind_hooks);
if (!NILP (prop))
{
- tail = Fcopy_sequence (tail);
+ if (!tail_copied)
+ tail = Fcopy_sequence (tail);
+ tail_copied = 1;
call_overlay_mod_hooks (prop, overlay, start, end);
}
}
prop = Foverlay_get (overlay, Qmodification_hooks);
if (!NILP (prop))
{
- tail = Fcopy_sequence (tail);
+ if (!tail_copied)
+ tail = Fcopy_sequence (tail);
+ tail_copied = 1;
call_overlay_mod_hooks (prop, overlay, start, end);
}
}
}
+ tail_copied = 0;
for (tail = current_buffer->overlays_after;
CONSP (tail);
tail = XCONS (tail)->cdr)
prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
if (!NILP (prop))
{
- tail = Fcopy_sequence (tail);
+ if (!tail_copied)
+ tail = Fcopy_sequence (tail);
+ tail_copied = 1;
call_overlay_mod_hooks (prop, overlay, start, end);
}
}
prop = Foverlay_get (overlay, Qinsert_behind_hooks);
if (!NILP (prop))
{
- tail = Fcopy_sequence (tail);
+ if (!tail_copied)
+ tail = Fcopy_sequence (tail);
+ tail_copied = 1;
call_overlay_mod_hooks (prop, overlay, start, end);
}
}
prop = Foverlay_get (overlay, Qmodification_hooks);
if (!NILP (prop))
{
- tail = Fcopy_sequence (tail);
+ if (!tail_copied)
+ tail = Fcopy_sequence (tail);
+ tail_copied = 1;
call_overlay_mod_hooks (prop, overlay, start, end);
}
}
}
+
+ UNGCPRO;
}
static void