changeset 68180:ca3d61094d2b

(widget-field-end): If the overlay is no longer associated with a buffer, behave as if the overlay didn't exist.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 13 Jan 2006 19:56:10 +0000
parents 83ac404539a7
children 43a16bd43626
files lisp/wid-edit.el
diffstat 1 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wid-edit.el	Fri Jan 13 19:50:10 2006 +0000
+++ b/lisp/wid-edit.el	Fri Jan 13 19:56:10 2006 +0000
@@ -1203,22 +1203,24 @@
     ;; or if a special `boundary' field has been added after the widget
     ;; field.
     (if (overlayp overlay)
-	(if (and (not (eq (with-current-buffer
-			      (widget-field-buffer widget)
-			    (save-restriction
-			      ;; `widget-narrow-to-field' can be
-			      ;; active when this function is called
-			      ;; from an change-functions hook. So
-			      ;; temporarily remove field narrowing
-			      ;; before to call `get-char-property'.
-			      (widen)
-			      (get-char-property (overlay-end overlay)
-						 'field)))
-			  'boundary))
-		 (or widget-field-add-space
-		     (null (widget-get widget :size))))
-	    (1- (overlay-end overlay))
-	  (overlay-end overlay))
+        ;; Don't proceed if overlay has been removed from buffer.
+        (when (overlay-buffer overlay)
+          (if (and (not (eq (with-current-buffer
+                                (widget-field-buffer widget)
+                              (save-restriction
+                                ;; `widget-narrow-to-field' can be
+                                ;; active when this function is called
+                                ;; from an change-functions hook. So
+                                ;; temporarily remove field narrowing
+                                ;; before to call `get-char-property'.
+                                (widen)
+                                (get-char-property (overlay-end overlay)
+                                                   'field)))
+                            'boundary))
+                   (or widget-field-add-space
+                       (null (widget-get widget :size))))
+              (1- (overlay-end overlay))
+            (overlay-end overlay)))
       (cdr overlay))))
 
 (defun widget-field-find (pos)