]> code.delx.au - gnu-emacs/blobdiff - lisp/net/rlogin.el
Add a provide statement.
[gnu-emacs] / lisp / net / rlogin.el
index 412016f580e217eb2e605dac7a55aa95340e9b6d..fa7e0d1950e774fc01b2fd98e2173f5f65e52566 100644 (file)
@@ -1,13 +1,11 @@
 ;;; rlogin.el --- remote login interface
 
-;; 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.
 
 ;; Author: Noah Friedman
 ;; Maintainer: Noah Friedman <friedman@splode.com>
 ;; Keywords: unix, comm
 
-;; $Id: rlogin.el,v 1.45 2000/01/31 18:07:17 fx Exp $
-
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -71,8 +69,8 @@
                 (string-match "-solaris2" system-configuration))
            t)
           (t nil)))
-  "*If non-`nil', use a pty for the local rlogin process.
-If `nil', use a pipe (if pipes are supported on the local system).
+  "*If non-nil, use a pty for the local rlogin process.
+If nil, use a pipe (if pipes are supported on the local system).
 
 Generally it is better not to waste ptys on systems which have a static
 number of them.  On the other hand, some implementations of `rlogin' assume
@@ -189,8 +187,7 @@ variable."
                    (user-login-name)))
          (buffer-name (if (string= user (user-login-name))
                           (format "*rlogin-%s*" host)
-                        (format "*rlogin-%s@%s*" user host)))
-        proc)
+                        (format "*rlogin-%s@%s*" user host))))
 
     (cond ((null buffer))
          ((stringp buffer)
@@ -205,28 +202,8 @@ variable."
     (setq buffer (get-buffer-create buffer-name))
     (pop-to-buffer buffer-name)
 
-    (cond
-     ((comint-check-proc buffer-name))
-     (t
+    (unless (comint-check-proc buffer-name)
       (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)))
 
       (rlogin-mode)
 
@@ -246,22 +223,13 @@ variable."
                 ((null rlogin-directory-tracking-mode))
                 (t
                  (cd-absolute (concat comint-file-name-prefix "~/"))))
-        (error nil))))))
+        (error nil)))))
 
 (put 'rlogin-mode 'mode-class 'special)
 
-(defun rlogin-mode ()
-  "Set major-mode for rlogin sessions.
-If `rlogin-mode-hook' is set, run it."
-  (interactive)
-  (kill-all-local-variables)
-  (shell-mode)
-  (setq major-mode 'rlogin-mode)
-  (setq mode-name "rlogin")
-  (use-local-map rlogin-mode-map)
+(define-derived-mode rlogin-mode shell-mode "Rlogin"
   (setq shell-dirtrackp rlogin-directory-tracking-mode)
-  (make-local-variable 'comint-file-name-prefix)
-  (run-hooks 'rlogin-mode-hook))
+  (make-local-variable 'comint-file-name-prefix))
 
 (defun rlogin-directory-tracking-mode (&optional prefix)
   "Do remote or local directory tracking, or disable entirely.
@@ -326,17 +294,6 @@ local one share the same directories (through NFS)."
     (set-match-data (match-data))
     (nreverse list)))
 
-(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)))
-
 (defun rlogin-send-Ctrl-C ()
   (interactive)
   (process-send-string nil "\C-c"))
@@ -370,4 +327,5 @@ Delete ARG characters forward, or send a C-d to process if at end of buffer."
 
 (provide 'rlogin)
 
+;;; arch-tag: 6e20eabf-feda-40fa-ab40-0d156db447e4
 ;;; rlogin.el ends here