diff options
author | Karl Heuer <kwzh@gnu.org> | 1995-03-22 21:23:10 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1995-03-22 21:23:10 +0000 |
commit | fc04fa47a486d7380b7fac90daa90b3cd091b011 (patch) | |
tree | ed230481a377c86a881c346ce2259a27b7bf64f1 /src/buffer.c | |
parent | 15874c5958f2480f3d77617b229734536830de42 (diff) | |
download | emacs-fc04fa47a486d7380b7fac90daa90b3cd091b011.tar.gz |
(overlay_touches_p): New function.
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 71ab0daaee3..96f2e56ec6e 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1631,6 +1631,47 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) *prev_ptr = prev; return idx; } + +/* Fast function to just test if we're at an overlay boundary. */ +int +overlay_touches_p (pos) + int pos; +{ + Lisp_Object tail, overlay; + + for (tail = current_buffer->overlays_before; GC_CONSP (tail); + tail = XCONS (tail)->cdr) + { + int endpos; + + overlay = XCONS (tail)->car; + if (!GC_OVERLAYP (overlay)) + abort (); + + endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); + if (endpos < pos) + break; + if (endpos == pos || OVERLAY_POSITION (OVERLAY_START (overlay)) == pos) + return 1; + } + + for (tail = current_buffer->overlays_after; GC_CONSP (tail); + tail = XCONS (tail)->cdr) + { + int startpos; + + overlay = XCONS (tail)->car; + if (!GC_OVERLAYP (overlay)) + abort (); + + startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); + if (pos < startpos) + break; + if (startpos == pos || OVERLAY_POSITION (OVERLAY_END (overlay)) == pos) + return 1; + } + return 0; +} struct sortvec { |