1 |
;;; rlogin.el --- remote login interface |
;;; rlogin.el --- remote login interface |
2 |
|
|
3 |
;; Copyright (C) 1992, 93, 94, 95, 97, 1998 Free Software Foundation, Inc. |
;; Copyright (C) 1992, 93, 94, 95, 97, 1998, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Noah Friedman |
;; Author: Noah Friedman |
6 |
;; Maintainer: Noah Friedman <friedman@splode.com> |
;; Maintainer: Noah Friedman <friedman@splode.com> |
189 |
(user-login-name))) |
(user-login-name))) |
190 |
(buffer-name (if (string= user (user-login-name)) |
(buffer-name (if (string= user (user-login-name)) |
191 |
(format "*rlogin-%s*" host) |
(format "*rlogin-%s*" host) |
192 |
(format "*rlogin-%s@%s*" user host))) |
(format "*rlogin-%s@%s*" user host)))) |
|
proc) |
|
193 |
|
|
194 |
(cond ((null buffer)) |
(cond ((null buffer)) |
195 |
((stringp buffer) |
((stringp buffer) |
204 |
(setq buffer (get-buffer-create buffer-name)) |
(setq buffer (get-buffer-create buffer-name)) |
205 |
(pop-to-buffer buffer-name) |
(pop-to-buffer buffer-name) |
206 |
|
|
207 |
(cond |
(unless (comint-check-proc buffer-name) |
|
((comint-check-proc buffer-name)) |
|
|
(t |
|
208 |
(comint-exec buffer buffer-name rlogin-program nil args) |
(comint-exec buffer buffer-name rlogin-program nil args) |
|
(setq proc (get-buffer-process buffer)) |
|
|
;; Set process-mark to point-max in case there is text in the |
|
|
;; buffer from a previous exited process. |
|
|
(set-marker (process-mark proc) (point-max)) |
|
|
|
|
|
;; comint-output-filter-functions is treated like a hook: it is |
|
|
;; processed via run-hooks or run-hooks-with-args in later versions |
|
|
;; of emacs. |
|
|
;; comint-output-filter-functions should already have a |
|
|
;; permanent-local property, at least in emacs 19.27 or later. |
|
|
(cond |
|
|
((fboundp 'make-local-hook) |
|
|
(make-local-hook 'comint-output-filter-functions) |
|
|
(add-hook 'comint-output-filter-functions 'rlogin-carriage-filter |
|
|
nil t)) |
|
|
(t |
|
|
(make-local-variable 'comint-output-filter-functions) |
|
|
(add-hook 'comint-output-filter-functions 'rlogin-carriage-filter))) |
|
209 |
|
|
210 |
(rlogin-mode) |
(rlogin-mode) |
211 |
|
|
225 |
((null rlogin-directory-tracking-mode)) |
((null rlogin-directory-tracking-mode)) |
226 |
(t |
(t |
227 |
(cd-absolute (concat comint-file-name-prefix "~/")))) |
(cd-absolute (concat comint-file-name-prefix "~/")))) |
228 |
(error nil)))))) |
(error nil))))) |
229 |
|
|
230 |
(put 'rlogin-mode 'mode-class 'special) |
(put 'rlogin-mode 'mode-class 'special) |
231 |
|
|
305 |
(set-match-data (match-data)) |
(set-match-data (match-data)) |
306 |
(nreverse list))) |
(nreverse list))) |
307 |
|
|
|
(defun rlogin-carriage-filter (string) |
|
|
(let* ((point-marker (point-marker)) |
|
|
(end (process-mark (get-buffer-process (current-buffer)))) |
|
|
(beg (or (and (boundp 'comint-last-output-start) |
|
|
comint-last-output-start) |
|
|
(- end (length string))))) |
|
|
(goto-char beg) |
|
|
(while (search-forward "\C-m" end t) |
|
|
(delete-char -1)) |
|
|
(goto-char point-marker))) |
|
|
|
|
308 |
(defun rlogin-send-Ctrl-C () |
(defun rlogin-send-Ctrl-C () |
309 |
(interactive) |
(interactive) |
310 |
(process-send-string nil "\C-c")) |
(process-send-string nil "\C-c")) |