diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-10-11 15:39:13 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-10-11 15:39:13 +0000 |
commit | 60eaf370b1082c18c39c7f54ad8a00bba9c6699f (patch) | |
tree | 2cb2d3da026feb11d68b634bf812417b340b9bc3 /lisp | |
parent | 03d50ea516614d5eb775da32a3713b77341ee277 (diff) | |
download | emacs-60eaf370b1082c18c39c7f54ad8a00bba9c6699f.tar.gz |
(find-alternate-file-other-window): New function.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index e9f9ed30c28..8254b8a456b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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 |