changeset 16678:9785672a3b84

(outline-discard-overlays): Use overlays-in, to ensure we get rid of empty overlays.
author Richard M. Stallman <rms@gnu.org>
date Sat, 14 Dec 1996 22:24:35 +0000
parents e5d1cfd4d29c
children 38c158927e6f
files lisp/textmodes/outline.el
diffstat 1 files changed, 15 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/outline.el	Sat Dec 14 22:23:58 1996 +0000
+++ b/lisp/textmodes/outline.el	Sat Dec 14 22:24:35 1996 +0000
@@ -386,25 +386,22 @@
   (if (< end beg)
       (setq beg (prog1 end (setq end beg))))
   (save-excursion
-    (goto-char beg)
-    (while (< (point) end)
-      (let ((overlays (overlays-at (point))))
-	(while overlays
-	  (let ((o (car overlays)))
-	    (if (overlay-get o prop)
-		;; Either push this overlay outside beg...end
-		;; or split it to exclude beg...end
-		;; or delete it entirely (if it is contained in beg...end).
-		(if (< (overlay-start o) beg)
-		    (if (> (overlay-end o) end)
-			(let ((o1 (outline-copy-overlay o)))
-			  (move-overlay o1 (overlay-start o1) beg)
-		      (move-overlay o (overlay-start o) beg)))
+    (let ((overlays (overlays-in beg end)))
+      (while overlays
+	(let ((o (car overlays)))
+	  (if (overlay-get o prop)
+	      ;; Either push this overlay outside beg...end
+	      ;; or split it to exclude beg...end
+	      ;; or delete it entirely (if it is contained in beg...end).
+	      (if (< (overlay-start o) beg)
 		  (if (> (overlay-end o) end)
-		      (move-overlay o end (overlay-end o))
-		    (delete-overlay o)))))
-	  (setq overlays (cdr overlays))))
-      (goto-char (next-overlay-change (point))))))
+		      (let ((o1 (outline-copy-overlay o)))
+			(move-overlay o1 (overlay-start o1) beg)
+		    (move-overlay o (overlay-start o) beg)))
+		(if (> (overlay-end o) end)
+		    (move-overlay o end (overlay-end o))
+		  (delete-overlay o)))))
+	(setq overlays (cdr overlays))))))
 
 ;; Make a copy of overlay O, with the same beginning, end and properties.
 (defun outline-copy-overlay (o)