changeset 68138:d47ecb3cad92

(reveal-post-command): window-buffer signals an error on dead windows rather than returning nil. (reveal-open-new-overlays): An overlay might die while we open others.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 11 Jan 2006 22:30:26 +0000
parents ec4727559827
children 058a6e577709
files lisp/ChangeLog lisp/reveal.el
diffstat 2 files changed, 43 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jan 11 21:02:35 2006 +0000
+++ b/lisp/ChangeLog	Wed Jan 11 22:30:26 2006 +0000
@@ -1,23 +1,29 @@
+2006-01-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* reveal.el (reveal-post-command): window-buffer signals an error on
+	dead windows rather than returning nil.
+	(reveal-open-new-overlays): An overlay might die while we open others.
+
 2006-01-11  Bill Wohler  <wohler@newt.com>
 
 	* cus-dep.el (generated-custom-dependencies-file): Fix typo and
 	phrasing in docstring.
 
 	* Makefile.in (MH_E_SRC): Rename from MH-E-SRC since the dashes
-	can give some systems gas. Add new file mh-buffers.el.
+	can give some systems gas.  Add new file mh-buffers.el.
 
 2006-01-06  Masatake YAMATO  <jet@gyve.org>
 
 	* font-lock.el (cpp-font-lock-keywords): Font lock keywords for
 	C preprocessor forward ported from GNU Emacs 21.2.
 
-	* progmodes/asm-mode.el (asm-font-lock-keywords): Use 
-	`cpp-font-lock-keywords'.
+	* progmodes/asm-mode.el (asm-font-lock-keywords):
+	Use `cpp-font-lock-keywords'.
 
 	* progmodes/ld-script.el (ld-script-font-lock-keywords): Ditto.
 
 	* progmodes/ld-script.el (auto-mode-alist): Use \\> instead
-	of $ for "\\.ld[s]?". 
+	of $ for "\\.ld[s]?".
 
 2006-01-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
--- a/lisp/reveal.el	Wed Jan 11 21:02:35 2006 +0000
+++ b/lisp/reveal.el	Wed Jan 11 22:30:26 2006 +0000
@@ -85,7 +85,8 @@
                         ;; a window which does not show this buffer any more.
                         (cond
                          ((eq (car x) (selected-window)) (cdr x))
-                         ((not (eq (window-buffer (car x)) (current-buffer)))
+                         ((not (and (window-live-p (car x))
+                                    (eq (window-buffer (car x)) (current-buffer))))
                           ;; Adopt this since it's owned by a window that's
                           ;; either not live or at least not showing this
                           ;; buffer any more.
@@ -104,35 +105,37 @@
                            (overlays-at (mark)))
                          (overlays-at (point))))
         (setq old-ols (delq ol old-ols))
-        (let ((inv (overlay-get ol 'invisible)) open)
-          (when (and inv
-                     ;; There's an `invisible' property.  Make sure it's
-                     ;; actually invisible, and ellipsised.
-                     (and (consp buffer-invisibility-spec)
-                          (cdr (assq inv buffer-invisibility-spec)))
-                     (or (setq open
-                               (or (overlay-get ol 'reveal-toggle-invisible)
-                                   (and (symbolp inv)
-                                        (get inv 'reveal-toggle-invisible))
-                                   (overlay-get ol 'isearch-open-invisible-temporary)))
-                         (overlay-get ol 'isearch-open-invisible)
-                         (and (consp buffer-invisibility-spec)
-                              (cdr (assq inv buffer-invisibility-spec))))
-                     (overlay-put ol 'reveal-invisible inv))
-            (push (cons (selected-window) ol) reveal-open-spots)
-            (if (null open)
-                (overlay-put ol 'invisible nil)
-              ;; Use the provided opening function and repeat (since the
-              ;; opening function might have hidden a subpart around point).
-              (setq repeat t)
-              (condition-case err
-                  (funcall open ol nil)
-                (error (message "!!Reveal-show (funcall %s %s nil): %s !!"
-                                open ol err)
-                       ;; Let's default to a meaningful behavior to avoid
-                       ;; getting stuck in an infinite loop.
-                       (setq repeat nil)
-                       (overlay-put ol 'invisible nil)))))))))
+        (when (overlay-start ol)        ;Check it's still live.
+          (let ((inv (overlay-get ol 'invisible)) open)
+            (when (and inv
+                       ;; There's an `invisible' property.  Make sure it's
+                       ;; actually invisible, and ellipsised.
+                       (and (consp buffer-invisibility-spec)
+                            (cdr (assq inv buffer-invisibility-spec)))
+                       (or (setq open
+                                 (or (overlay-get ol 'reveal-toggle-invisible)
+                                     (and (symbolp inv)
+                                          (get inv 'reveal-toggle-invisible))
+                                     (overlay-get ol 'isearch-open-invisible-temporary)))
+                           (overlay-get ol 'isearch-open-invisible)
+                           (and (consp buffer-invisibility-spec)
+                                (cdr (assq inv buffer-invisibility-spec))))
+                       (overlay-put ol 'reveal-invisible inv))
+              (push (cons (selected-window) ol) reveal-open-spots)
+              (if (null open)
+                  (overlay-put ol 'invisible nil)
+                ;; Use the provided opening function and repeat (since the
+                ;; opening function might have hidden a subpart around point
+                ;; or moved/killed some of the overlays).
+                (setq repeat t)
+                (condition-case err
+                    (funcall open ol nil)
+                  (error (message "!!Reveal-show (funcall %s %s nil): %s !!"
+                                  open ol err)
+                         ;; Let's default to a meaningful behavior to avoid
+                         ;; getting stuck in an infinite loop.
+                         (setq repeat nil)
+                         (overlay-put ol 'invisible nil))))))))))
   old-ols)
 
 (defun reveal-close-old-overlays (old-ols)