diff lisp/subr.el @ 107132:6429fc34756a

* subr.el (copy-overlay): Handle deleted overlays.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 11 Feb 2010 14:35:36 -0500
parents 1d1d5d9bd884
children a0d4034e4be0
line wrap: on
line diff
--- a/lisp/subr.el	Thu Feb 11 11:00:01 2010 -0500
+++ b/lisp/subr.el	Thu Feb 11 14:35:36 2010 -0500
@@ -2232,10 +2232,14 @@
 
 (defun copy-overlay (o)
   "Return a copy of overlay O."
-  (let ((o1 (make-overlay (overlay-start o) (overlay-end o)
-			  ;; FIXME: there's no easy way to find the
-			  ;; insertion-type of the two markers.
-			  (overlay-buffer o)))
+  (let ((o1 (if (overlay-buffer o)
+                (make-overlay (overlay-start o) (overlay-end o)
+                              ;; FIXME: there's no easy way to find the
+                              ;; insertion-type of the two markers.
+                              (overlay-buffer o))
+              (let ((o1 (make-overlay (point-min) (point-min))))
+                (delete-overlay o1)
+                o1))))
 	(props (overlay-properties o)))
     (while props
       (overlay-put o1 (pop props) (pop props)))