changeset 30695:48cc3d076524

(overlays_at): Add CHANGE_REQ parameter. (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change): Use it.
author Miles Bader <miles@gnu.org>
date Tue, 08 Aug 2000 23:45:38 +0000
parents 766ccccf5c4f
children 5d83aa68f248
files src/buffer.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Tue Aug 08 22:55:38 2000 +0000
+++ b/src/buffer.c	Tue Aug 08 23:45:38 2000 +0000
@@ -1,5 +1,5 @@
 /* Buffer manipulation primitives for GNU Emacs.
-   Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999
+   Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000
 	Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -2230,16 +2230,21 @@
    If EXTEND is non-zero, we make the vector bigger if necessary.
    If EXTEND is zero, we never extend the vector,
    and we store only as many overlays as will fit.
-   But we still return the total number of overlays.  */
+   But we still return the total number of overlays.
+
+   If CHANGE_REQ is true, then any position written into *PREV_PTR or
+   *NEXT_PTR is guaranteed to be not equal to POS, unless it is the
+   default (BEGV or ZV).  */
 
 int
-overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
+overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
      int pos;
      int extend;
      Lisp_Object **vec_ptr;
      int *len_ptr;
      int *next_ptr;
      int *prev_ptr;
+     int change_req;
 {
   Lisp_Object tail, overlay, start, end;
   int idx = 0;
@@ -2345,7 +2350,7 @@
 	}
       else if (endpos < pos && endpos > prev)
 	prev = endpos;
-      else if (endpos == pos && startpos > prev)
+      else if (endpos == pos && startpos > prev && !change_req)
 	prev = startpos;
     }
 
@@ -3517,7 +3522,7 @@
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.  */
   noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
-			   (int *) 0, (int *) 0);
+			   (int *) 0, (int *) 0, 0);
 
   /* Make a list of them all.  */
   result = Flist (noverlays, overlay_vec);
@@ -3580,7 +3585,7 @@
      Store the length in len.
      endpos gets the position where the next overlay starts.  */
   noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
-			   &endpos, (int *) 0);
+			   &endpos, (int *) 0, 1);
 
   /* If any of these overlays ends before endpos,
      use its ending point instead.  */
@@ -3625,7 +3630,7 @@
      Store the length in len.
      prevpos gets the position of the previous change.  */
   noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
-			   (int *) 0, &prevpos);
+			   (int *) 0, &prevpos, 1);
 
   xfree (overlay_vec);
   return make_number (prevpos);