aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-05-14 14:43:00 +0000
committerJim Blandy1993-05-14 14:43:00 +0000
commit6c523803b30c3d41a21ce36fbfb0437bf6ce68e5 (patch)
tree199b84236efddfe3266049b14df615cb0f8a4ee1 /src
parent93b9120871c50c14ed8818b380307174383c4fd6 (diff)
downloademacs-6c523803b30c3d41a21ce36fbfb0437bf6ce68e5.tar.gz
emacs-6c523803b30c3d41a21ce36fbfb0437bf6ce68e5.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c1
-rw-r--r--src/buffer.h3
-rw-r--r--src/fns.c3
-rw-r--r--src/print.c17
4 files changed, 21 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c
index b0c120bad81..6aaa34dfc21 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1609,6 +1609,7 @@ mark_object (objptr)
1609 case Lisp_Cons: 1609 case Lisp_Cons:
1610 case Lisp_Buffer_Local_Value: 1610 case Lisp_Buffer_Local_Value:
1611 case Lisp_Some_Buffer_Local_Value: 1611 case Lisp_Some_Buffer_Local_Value:
1612 case Lisp_Overlay:
1612 { 1613 {
1613 register struct Lisp_Cons *ptr = XCONS (obj); 1614 register struct Lisp_Cons *ptr = XCONS (obj);
1614 if (XMARKBIT (ptr->car)) break; 1615 if (XMARKBIT (ptr->car)) break;
diff --git a/src/buffer.h b/src/buffer.h
index 34d92fd61c7..3ab666c07bf 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -370,7 +370,7 @@ extern Lisp_Object Vtransient_mark_mode;
370 Therefore, we cannot assume that they remain valid--we must check. */ 370 Therefore, we cannot assume that they remain valid--we must check. */
371 371
372/* 1 if the OV is a cons cell whose car is a cons cell. */ 372/* 1 if the OV is a cons cell whose car is a cons cell. */
373#define OVERLAY_VALID(OV) (CONSP ((OV)) && CONSP (XCONS ((OV))->car)) 373#define OVERLAY_VALID(OV) (OVERLAYP (OV))
374 374
375/* Return the marker that stands for where OV starts in the buffer. */ 375/* Return the marker that stands for where OV starts in the buffer. */
376#define OVERLAY_START(OV) (XCONS (XCONS ((OV))->car)->car) 376#define OVERLAY_START(OV) (XCONS (XCONS ((OV))->car)->car)
@@ -386,7 +386,6 @@ extern Lisp_Object Vtransient_mark_mode;
386 ((MARKERP ((P)) && XMARKER ((P))->buffer == current_buffer) \ 386 ((MARKERP ((P)) && XMARKER ((P))->buffer == current_buffer) \
387 ? marker_position ((P)) : 0) 387 ? marker_position ((P)) : 0)
388 388
389
390/* Allocation of buffer text. */ 389/* Allocation of buffer text. */
391 390
392#ifdef REL_ALLOC 391#ifdef REL_ALLOC
diff --git a/src/fns.c b/src/fns.c
index 7990bf431de..328cf984c71 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -844,7 +844,8 @@ do_cdr:
844 } 844 }
845#endif 845#endif
846 if (XTYPE (o1) != XTYPE (o2)) return Qnil; 846 if (XTYPE (o1) != XTYPE (o2)) return Qnil;
847 if (XTYPE (o1) == Lisp_Cons) 847 if (XTYPE (o1) == Lisp_Cons
848 || XTYPE (o1) == Lisp_Overlay)
848 { 849 {
849 Lisp_Object v1; 850 Lisp_Object v1;
850 v1 = internal_equal (Fcar (o1), Fcar (o2), depth + 1); 851 v1 = internal_equal (Fcar (o1), Fcar (o2), depth + 1);
diff --git a/src/print.c b/src/print.c
index ba41e46454e..23901175de1 100644
--- a/src/print.c
+++ b/src/print.c
@@ -952,6 +952,23 @@ print (obj, printcharfun, escapeflag)
952 } 952 }
953 PRINTCHAR ('>'); 953 PRINTCHAR ('>');
954 break; 954 break;
955
956 case Lisp_Overlay:
957 strout ("#<overlay ", -1, printcharfun);
958 if (!(XMARKER (OVERLAY_START (obj))->buffer))
959 strout ("in no buffer", -1, printcharfun);
960 else
961 {
962 sprintf (buf, "from %d to %d in ",
963 marker_position (OVERLAY_START (obj)),
964 marker_position (OVERLAY_END (obj)));
965 strout (buf, -1, printcharfun);
966 print_string (XMARKER (OVERLAY_START (obj))->buffer->name,
967 printcharfun);
968 }
969 PRINTCHAR ('>');
970 break;
971
955#endif /* standalone */ 972#endif /* standalone */
956 973
957 case Lisp_Subr: 974 case Lisp_Subr: