]> git.eshelyaron.com Git - emacs.git/commitdiff
(find-alternate-file-other-window): New function.
authorRichard M. Stallman <rms@gnu.org>
Wed, 11 Oct 1995 15:39:13 +0000 (15:39 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 11 Oct 1995 15:39:13 +0000 (15:39 +0000)
lisp/files.el

index e9f9ed30c2879369f292108e7d8da6b0eb557124..8254b8a456b192fdd000f1b6848cc53a53dec03d 100644 (file)
@@ -514,6 +514,26 @@ Use \\[toggle-read-only] to permit editing."
   (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