changeset 13182:55c6e0f3c2f4

(find-alternate-file-other-window): New function.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Oct 1995 15:39:13 +0000
parents fc4f18921b24
children 6b79b1d9cddd
files lisp/files.el
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Wed Oct 11 15:17:44 1995 +0000
+++ b/lisp/files.el	Wed Oct 11 15:39:13 1995 +0000
@@ -514,6 +514,26 @@
   (setq buffer-read-only t)
   (current-buffer))
 
+(defun find-alternate-file-other-window (filename)
+  "Find file FILENAME as a replacement for the file in the next window.
+This command does not select that window."
+  (interactive
+   (save-selected-window
+     (other-window 1)
+     (let ((file buffer-file-name)
+	   (file-name nil)
+	   (file-dir nil))
+       (and file
+	    (setq file-name (file-name-nondirectory file)
+		  file-dir (file-name-directory file)))
+       (list (read-file-name
+	      "Find alternate file: " file-dir nil nil file-name)))))
+  (if (one-window-p)
+      (find-file-other-window filename)
+    (save-selected-window
+      (other-window 1)
+      (find-alternate-file filename))))
+
 (defun find-alternate-file (filename)
   "Find file FILENAME, select its buffer, kill previous buffer.
 If the current buffer now contains an empty file that you just visited