(reveal-post-command): window-buffer signals an error on
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 11 Jan 2006 22:30:26 +0000 (22:30 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 11 Jan 2006 22:30:26 +0000 (22:30 +0000)
dead windows rather than returning nil.
(reveal-open-new-overlays): An overlay might die while we open others.

lisp/ChangeLog
lisp/reveal.el

index 946f69c..4375de0 100644 (file)
@@ -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>
 
index 3c76c2a..4120f93 100644 (file)
@@ -85,7 +85,8 @@ Each element has the form (WINDOW . OVERLAY).")
                         ;; 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 @@ Each element has the form (WINDOW . OVERLAY).")
                            (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)