comparison lisp/rlogin.el @ 10977:a173cfead4ce

(rlogin): Use pop-to-buffer. (same-window-regexps): Add elt to match *rlogin-...* with or without <N> at end.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 Mar 1995 18:18:29 +0000
parents eb6af491e98f
children 57b244b67848
comparison
equal deleted inserted replaced
10976:354c9e79de15 10977:a173cfead4ce
18 ;; 18 ;;
19 ;; You should have received a copy of the GNU General Public License 19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program; if not, write to: The Free Software Foundation, 20 ;; along with this program; if not, write to: The Free Software Foundation,
21 ;; Inc.; 675 Massachusetts Avenue.; Cambridge, MA 02139, USA. 21 ;; Inc.; 675 Massachusetts Avenue.; Cambridge, MA 02139, USA.
22 22
23 ;; $Id$ 23 ;; $Id: rlogin.el,v 1.24 1995/02/28 09:51:49 friedman Exp rms $
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;; Support for remote logins using `rlogin'. 27 ;; Support for remote logins using `rlogin'.
28 ;; This program is layered on top of shell.el; the code here only accounts 28 ;; This program is layered on top of shell.el; the code here only accounts
98 (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) 98 (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash)
99 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D) 99 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D)
100 (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete))) 100 (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete)))
101 101
102 102
103 ;;;###autoload (add-hook 'same-window-regexps "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)")
104
103 ;;;###autoload 105 ;;;###autoload
104 (defun rlogin (input-args &optional prefix) 106 (defun rlogin (input-args &optional prefix)
105 "Open a network login connection to HOST via the `rlogin' program. 107 "Open a network login connection to HOST via the `rlogin' program.
106 Input is sent line-at-a-time to the remote connection. 108 Input is sent line-at-a-time to the remote connection.
107 109
108 Communication with the remote host is recorded in a buffer *rlogin-HOST* 110 Communication with the remote host is recorded in a buffer `*rlogin-HOST*'
109 \(or *rlogin-USER@HOST* if the remote username differs\). 111 \(or `*rlogin-USER@HOST*' if the remote username differs\).
110 If a prefix argument is given and the buffer *rlogin-HOST* already exists, 112 If a prefix argument is given and the buffer `*rlogin-HOST*' already exists,
111 a new buffer with a different connection will be made. 113 a new buffer with a different connection will be made.
112 114
113 The variable `rlogin-program' contains the name of the actual program to 115 The variable `rlogin-program' contains the name of the actual program to
114 run. It can be a relative or absolute path. 116 run. It can be a relative or absolute path.
115 117
149 proc) 151 proc)
150 152
151 (cond 153 (cond
152 ((and (null prefix) 154 ((and (null prefix)
153 (comint-check-proc buffer-name)) 155 (comint-check-proc buffer-name))
154 (switch-to-buffer buffer-name)) 156 (pop-to-buffer buffer-name))
155 ;; This next case is done all in the predicate (including side effects 157 ;; This next case is done all in the predicate (including side effects
156 ;; like switch-to-buffer) to avoid extra string consing via multiple 158 ;; like pop-to-buffer) to avoid extra string consing via multiple
157 ;; concats. 159 ;; concats.
158 ((and (numberp prefix) 160 ((and (numberp prefix)
159 (let ((bufname (concat buffer-name "<" prefix ">"))) 161 (let ((bufname (concat buffer-name "<" prefix ">")))
160 (and (comint-check-proc bufname) 162 (and (comint-check-proc bufname)
161 (switch-to-buffer bufname))))) 163 (pop-to-buffer bufname)))))
162 (t 164 (t
163 (cond 165 (cond
164 ((numberp prefix) 166 ((numberp prefix)
165 (setq buffer-name (concat buffer-name "<" prefix ">"))) 167 (setq buffer-name (concat buffer-name "<" prefix ">")))
166 (t 168 (t
167 (setq buffer-name (generate-new-buffer-name buffer-name)))) 169 (setq buffer-name (generate-new-buffer-name buffer-name))))
168 (switch-to-buffer buffer-name) 170 (pop-to-buffer buffer-name)
169 (comint-exec (current-buffer) buffer-name rlogin-program nil args) 171 (comint-exec (current-buffer) buffer-name rlogin-program nil args)
170 (setq proc (get-process buffer-name)) 172 (setq proc (get-process buffer-name))
171 ;; Set process-mark to point-max in case there is text in the 173 ;; Set process-mark to point-max in case there is text in the
172 ;; buffer from a previous exited process. 174 ;; buffer from a previous exited process.
173 (set-marker (process-mark proc) (point-max)) 175 (set-marker (process-mark proc) (point-max))