changeset 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 741ff2bdfe79
children a0d4034e4be0
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Feb 11 11:00:01 2010 -0500
+++ b/lisp/ChangeLog	Thu Feb 11 14:35:36 2010 -0500
@@ -1,5 +1,7 @@
 2010-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* subr.el (copy-overlay): Handle deleted overlays.
+
 	* man.el (Man-completion-table): Don't signal an error if we can't run
 	manual-program (bug#4056).
 
--- 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)))