static struct Lisp_Overlay *
copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
{
- Lisp_Object buffer;
struct Lisp_Overlay *result = NULL, *tail = NULL;
- XSETBUFFER (buffer, b);
-
for (; list; list = list->next)
{
- Lisp_Object overlay, start, end, old_overlay;
- ptrdiff_t charpos;
-
- XSETMISC (old_overlay, list);
- charpos = marker_position (OVERLAY_START (old_overlay));
- start = Fmake_marker ();
- Fset_marker (start, make_number (charpos), buffer);
- XMARKER (start)->insertion_type
- = XMARKER (OVERLAY_START (old_overlay))->insertion_type;
+ Lisp_Object overlay, start, end;
+ struct Lisp_Marker *m;
- charpos = marker_position (OVERLAY_END (old_overlay));
- end = Fmake_marker ();
- Fset_marker (end, make_number (charpos), buffer);
- XMARKER (end)->insertion_type
- = XMARKER (OVERLAY_END (old_overlay))->insertion_type;
+ eassert (MARKERP (list->start));
+ m = XMARKER (list->start);
+ start = build_marker (b, m->charpos, m->bytepos);
+ XMARKER (start)->insertion_type = m->insertion_type;
- overlay = build_overlay
- (start, end, Fcopy_sequence (OVERLAY_PLIST (old_overlay)));
+ eassert (MARKERP (list->end));
+ m = XMARKER (list->end);
+ end = build_marker (b, m->charpos, m->bytepos);
+ XMARKER (end)->insertion_type = m->insertion_type;
+ overlay = build_overlay (start, end, Fcopy_sequence (list->plist));
if (tail)
tail = tail->next = XOVERLAY (overlay);
else
/* START and END are markers in the overlay's buffer, and
PLIST is the overlay's property list. */
struct Lisp_Overlay
+/* An overlay's real data content is:
+ - plist
+ - buffer (really there are two buffer pointers, one per marker,
+ and both points to the same buffer)
+ - insertion type of both ends (per-marker fields)
+ - start & start byte (of start marker)
+ - end & end byte (of end marker)
+ - next (singly linked list of overlays)
+ - next fields of start and end markers (singly linked list of markers).
+ I.e. 9words plus 2 bits, 3words of which are for external linked lists.
+*/
{
ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
unsigned gcmarkbit : 1;