comparison lisp/net/rlogin.el @ 43900:59bea220f067

(rlogin-carriage-filter): Function removed. (rlogin): Don't install the `rlogin-carriage-filter' filter, as comint removes carriage returns itself now.
author Miles Bader <miles@gnu.org>
date Thu, 14 Mar 2002 08:51:43 +0000
parents b56f9152e329
children 47fa5e2f85ab
comparison
equal deleted inserted replaced
43899:2b9c79cd9ecb 43900:59bea220f067
1 ;;; rlogin.el --- remote login interface 1 ;;; rlogin.el --- remote login interface
2 2
3 ;; Copyright (C) 1992, 93, 94, 95, 97, 1998 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992, 93, 94, 95, 97, 1998, 2002 Free Software Foundation, Inc.
4 4
5 ;; Author: Noah Friedman 5 ;; Author: Noah Friedman
6 ;; Maintainer: Noah Friedman <friedman@splode.com> 6 ;; Maintainer: Noah Friedman <friedman@splode.com>
7 ;; Keywords: unix, comm 7 ;; Keywords: unix, comm
8 8
9 ;; $Id: rlogin.el,v 1.45 2000/01/31 18:07:17 fx Exp $ 9 ;; $Id: rlogin.el,v 1.1 2000/03/20 12:52:39 gerd Exp $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
187 (host (car args)) 187 (host (car args))
188 (user (or (car (cdr (member "-l" args))) 188 (user (or (car (cdr (member "-l" args)))
189 (user-login-name))) 189 (user-login-name)))
190 (buffer-name (if (string= user (user-login-name)) 190 (buffer-name (if (string= user (user-login-name))
191 (format "*rlogin-%s*" host) 191 (format "*rlogin-%s*" host)
192 (format "*rlogin-%s@%s*" user host))) 192 (format "*rlogin-%s@%s*" user host))))
193 proc)
194 193
195 (cond ((null buffer)) 194 (cond ((null buffer))
196 ((stringp buffer) 195 ((stringp buffer)
197 (setq buffer-name buffer)) 196 (setq buffer-name buffer))
198 ((bufferp buffer) 197 ((bufferp buffer)
203 (setq buffer-name (generate-new-buffer-name buffer-name)))) 202 (setq buffer-name (generate-new-buffer-name buffer-name))))
204 203
205 (setq buffer (get-buffer-create buffer-name)) 204 (setq buffer (get-buffer-create buffer-name))
206 (pop-to-buffer buffer-name) 205 (pop-to-buffer buffer-name)
207 206
208 (cond 207 (unless (comint-check-proc buffer-name)
209 ((comint-check-proc buffer-name))
210 (t
211 (comint-exec buffer buffer-name rlogin-program nil args) 208 (comint-exec buffer buffer-name rlogin-program nil args)
212 (setq proc (get-buffer-process buffer))
213 ;; Set process-mark to point-max in case there is text in the
214 ;; buffer from a previous exited process.
215 (set-marker (process-mark proc) (point-max))
216
217 ;; comint-output-filter-functions is treated like a hook: it is
218 ;; processed via run-hooks or run-hooks-with-args in later versions
219 ;; of emacs.
220 ;; comint-output-filter-functions should already have a
221 ;; permanent-local property, at least in emacs 19.27 or later.
222 (cond
223 ((fboundp 'make-local-hook)
224 (make-local-hook 'comint-output-filter-functions)
225 (add-hook 'comint-output-filter-functions 'rlogin-carriage-filter
226 nil t))
227 (t
228 (make-local-variable 'comint-output-filter-functions)
229 (add-hook 'comint-output-filter-functions 'rlogin-carriage-filter)))
230 209
231 (rlogin-mode) 210 (rlogin-mode)
232 211
233 (make-local-variable 'rlogin-host) 212 (make-local-variable 'rlogin-host)
234 (setq rlogin-host host) 213 (setq rlogin-host host)
244 (concat "/" rlogin-remote-user "@" rlogin-host ":")) 223 (concat "/" rlogin-remote-user "@" rlogin-host ":"))
245 (cd-absolute comint-file-name-prefix)) 224 (cd-absolute comint-file-name-prefix))
246 ((null rlogin-directory-tracking-mode)) 225 ((null rlogin-directory-tracking-mode))
247 (t 226 (t
248 (cd-absolute (concat comint-file-name-prefix "~/")))) 227 (cd-absolute (concat comint-file-name-prefix "~/"))))
249 (error nil)))))) 228 (error nil)))))
250 229
251 (put 'rlogin-mode 'mode-class 'special) 230 (put 'rlogin-mode 'mode-class 'special)
252 231
253 (defun rlogin-mode () 232 (defun rlogin-mode ()
254 "Set major-mode for rlogin sessions. 233 "Set major-mode for rlogin sessions.
324 list)) 303 list))
325 (setq posn (match-end 0))) 304 (setq posn (match-end 0)))
326 (set-match-data (match-data)) 305 (set-match-data (match-data))
327 (nreverse list))) 306 (nreverse list)))
328 307
329 (defun rlogin-carriage-filter (string)
330 (let* ((point-marker (point-marker))
331 (end (process-mark (get-buffer-process (current-buffer))))
332 (beg (or (and (boundp 'comint-last-output-start)
333 comint-last-output-start)
334 (- end (length string)))))
335 (goto-char beg)
336 (while (search-forward "\C-m" end t)
337 (delete-char -1))
338 (goto-char point-marker)))
339
340 (defun rlogin-send-Ctrl-C () 308 (defun rlogin-send-Ctrl-C ()
341 (interactive) 309 (interactive)
342 (process-send-string nil "\C-c")) 310 (process-send-string nil "\C-c"))
343 311
344 (defun rlogin-send-Ctrl-D () 312 (defun rlogin-send-Ctrl-D ()