Commit 6c523803 authored by Jim Blandy's avatar Jim Blandy
Browse files

* lisp.h (Lisp_Overlay): New tag.

	(OVERLAYP): New predicate.
	(CHECK_OVERLAY): New type-checker.
	(Qoverlayp): New extern declaration.
	* buffer.c (Foverlayp): New function.
	(Qoverlayp): New atom.
	(overlays_at, recenter_overlay_lists): Abort if we encounter an
	invalid overlay.
	(syms_of_buffer): defsubr Soverlayp; initialize Qoverlayp.
	(Fdelete_overlay): Set the overlay's markers to point nowhere.
	Use CHECK_OVERLAY instead of signalling a special error.
	(Fmove_overlay, Foverlay_put): Use CHECK_OVERLAY instead of
	signalling a special error.
	(Foverlay_get): Use CHECK_OVERLAY.
	* fns.c (internal_equal): Define this for overlays.
	* buffer.h (OVERLAY_VALID): Define in terms of OVERLAYP.
	* print.c (print): Give overlays their own print syntax.
	* alloc.c (mark_object): Treat overlays like conses.
parent 93b91208
......@@ -1609,6 +1609,7 @@ mark_object (objptr)
case Lisp_Cons:
case Lisp_Buffer_Local_Value:
case Lisp_Some_Buffer_Local_Value:
case Lisp_Overlay:
{
register struct Lisp_Cons *ptr = XCONS (obj);
if (XMARKBIT (ptr->car)) break;
......
......@@ -370,7 +370,7 @@ extern Lisp_Object Vtransient_mark_mode;
Therefore, we cannot assume that they remain valid--we must check. */
/* 1 if the OV is a cons cell whose car is a cons cell. */
#define OVERLAY_VALID(OV) (CONSP ((OV)) && CONSP (XCONS ((OV))->car))
#define OVERLAY_VALID(OV) (OVERLAYP (OV))
/* Return the marker that stands for where OV starts in the buffer. */
#define OVERLAY_START(OV) (XCONS (XCONS ((OV))->car)->car)
......@@ -386,7 +386,6 @@ extern Lisp_Object Vtransient_mark_mode;
((MARKERP ((P)) && XMARKER ((P))->buffer == current_buffer) \
? marker_position ((P)) : 0)
/* Allocation of buffer text. */
#ifdef REL_ALLOC
......
......@@ -844,7 +844,8 @@ internal_equal (o1, o2, depth)
}
#endif
if (XTYPE (o1) != XTYPE (o2)) return Qnil;
if (XTYPE (o1) == Lisp_Cons)
if (XTYPE (o1) == Lisp_Cons
|| XTYPE (o1) == Lisp_Overlay)
{
Lisp_Object v1;
v1 = internal_equal (Fcar (o1), Fcar (o2), depth + 1);
......
......@@ -952,6 +952,23 @@ print (obj, printcharfun, escapeflag)
}
PRINTCHAR ('>');
break;
case Lisp_Overlay:
strout ("#<overlay ", -1, printcharfun);
if (!(XMARKER (OVERLAY_START (obj))->buffer))
strout ("in no buffer", -1, printcharfun);
else
{
sprintf (buf, "from %d to %d in ",
marker_position (OVERLAY_START (obj)),
marker_position (OVERLAY_END (obj)));
strout (buf, -1, printcharfun);
print_string (XMARKER (OVERLAY_START (obj))->buffer->name,
printcharfun);
}
PRINTCHAR ('>');
break;
#endif /* standalone */
case Lisp_Subr:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment