diff options
| author | Juri Linkov | 2008-04-22 19:48:02 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-04-22 19:48:02 +0000 |
| commit | e4c0cccf13cebcdbd14d3cd65a982fae0afdc64a (patch) | |
| tree | c17e52d34e4ae8ca38f59db98aadcbd32dc415bd | |
| parent | 8b04c0ae7659ec81ef37c6feca9f330dae4d8ede (diff) | |
| download | emacs-e4c0cccf13cebcdbd14d3cd65a982fae0afdc64a.tar.gz emacs-e4c0cccf13cebcdbd14d3cd65a982fae0afdc64a.zip | |
(read-buffer-to-switch): New function.
(switch-to-buffer-other-window, switch-to-buffer-other-frame):
Change interactive spec to call read-buffer-to-switch instead of
using the letter "B".
| -rw-r--r-- | lisp/files.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el index 8b0952dc382..fc86df1bc3b 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1039,6 +1039,17 @@ use with M-x." | |||
| 1039 | (rename-file encoded new-encoded ok-if-already-exists) | 1039 | (rename-file encoded new-encoded ok-if-already-exists) |
| 1040 | newname)) | 1040 | newname)) |
| 1041 | 1041 | ||
| 1042 | (defun read-buffer-to-switch (prompt) | ||
| 1043 | "Read the name of a buffer to switch to and return as a string. | ||
| 1044 | It is intended for `switch-to-buffer' family of commands since they | ||
| 1045 | need to omit the name of current buffer from the list of complations | ||
| 1046 | and default values." | ||
| 1047 | (minibuffer-with-setup-hook | ||
| 1048 | (lambda () | ||
| 1049 | (set (make-local-variable 'minibuffer-completion-table) | ||
| 1050 | (internal-complete-buffer-except (other-buffer (current-buffer) t)))) | ||
| 1051 | (read-buffer prompt (other-buffer (current-buffer))))) | ||
| 1052 | |||
| 1042 | (defun switch-to-buffer-other-window (buffer &optional norecord) | 1053 | (defun switch-to-buffer-other-window (buffer &optional norecord) |
| 1043 | "Select buffer BUFFER in another window. | 1054 | "Select buffer BUFFER in another window. |
| 1044 | If BUFFER does not identify an existing buffer, then this function | 1055 | If BUFFER does not identify an existing buffer, then this function |
| @@ -1053,7 +1064,8 @@ This function returns the buffer it switched to. | |||
| 1053 | 1064 | ||
| 1054 | This uses the function `display-buffer' as a subroutine; see its | 1065 | This uses the function `display-buffer' as a subroutine; see its |
| 1055 | documentation for additional customization information." | 1066 | documentation for additional customization information." |
| 1056 | (interactive "BSwitch to buffer in other window: ") | 1067 | (interactive |
| 1068 | (list (read-buffer-to-switch "Switch to buffer in other window: "))) | ||
| 1057 | (let ((pop-up-windows t) | 1069 | (let ((pop-up-windows t) |
| 1058 | ;; Don't let these interfere. | 1070 | ;; Don't let these interfere. |
| 1059 | same-window-buffer-names same-window-regexps) | 1071 | same-window-buffer-names same-window-regexps) |
| @@ -1067,7 +1079,8 @@ This function returns the buffer it switched to. | |||
| 1067 | 1079 | ||
| 1068 | This uses the function `display-buffer' as a subroutine; see its | 1080 | This uses the function `display-buffer' as a subroutine; see its |
| 1069 | documentation for additional customization information." | 1081 | documentation for additional customization information." |
| 1070 | (interactive "BSwitch to buffer in other frame: ") | 1082 | (interactive |
| 1083 | (list (read-buffer-to-switch "Switch to buffer in other frame: "))) | ||
| 1071 | (let ((pop-up-frames t) | 1084 | (let ((pop-up-frames t) |
| 1072 | same-window-buffer-names same-window-regexps) | 1085 | same-window-buffer-names same-window-regexps) |
| 1073 | (prog1 | 1086 | (prog1 |