From 23e0c1a3bc240a544bdc3069a37ece1ca8d4b891 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 11 Jan 2006 22:30:26 +0000 Subject: [PATCH] (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. --- lisp/ChangeLog | 14 +++++++---- lisp/reveal.el | 63 ++++++++++++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 946f69c9f67..4375de0c189 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,23 +1,29 @@ +2006-01-11 Stefan Monnier + + * 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 * 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 * 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 diff --git a/lisp/reveal.el b/lisp/reveal.el index 3c76c2a2e8b..4120f9331b3 100644 --- a/lisp/reveal.el +++ b/lisp/reveal.el @@ -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) -- 2.39.2