changeset 46896:549bdeb52a93

(split-window-save-restore-data): Use push and with-current-buffer. (handle-select-window): Don't do anything if the window has disappeared since the event was generated.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 15 Aug 2002 00:34:04 +0000
parents 61e9b1699fd2
children 6deaf2e0ade2
files lisp/window.el
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/window.el	Thu Aug 15 00:12:30 2002 +0000
+++ b/lisp/window.el	Thu Aug 15 00:34:04 2002 +0000
@@ -239,7 +239,7 @@
 					  (setq done nil))))))
 			'nomini))))))
 
-;;; I think this should be the default; I think people will prefer it--rms.
+;; I think this should be the default; I think people will prefer it--rms.
 (defcustom split-window-keep-point t
   "*If non-nil, split windows keeps the original point in both children.
 This is often more convenient for editing.
@@ -300,13 +300,11 @@
 (defvar view-return-to-alist)
 
 (defun split-window-save-restore-data (new-w old-w)
-  (save-excursion
-    (set-buffer (window-buffer))
+  (with-current-buffer (window-buffer)
     (if view-mode
 	(let ((old-info (assq old-w view-return-to-alist)))
-	  (setq view-return-to-alist
-		(cons (cons new-w (cons (and old-info (car (cdr old-info))) t))
-		      view-return-to-alist))))
+	  (push (cons new-w (cons (and old-info (car (cdr old-info))) t))
+		view-return-to-alist)))
     new-w))
 
 (defun split-window-horizontally (&optional arg)
@@ -582,8 +580,9 @@
   "Handle select-window events."
   (interactive "e")
   (let ((window (posn-window (event-start event))))
-    (if (or (not (window-minibuffer-p window))
-	    (minibuffer-window-active-p window))
+    (if (and (window-live-p window)
+	     (or (not (window-minibuffer-p window))
+		 (minibuffer-window-active-p window)))
 	(select-window window))))
 
 (define-key ctl-x-map "2" 'split-window-vertically)