aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Friedman1993-10-18 07:05:11 +0000
committerNoah Friedman1993-10-18 07:05:11 +0000
commit97b83d9daa6e84b4ea23413dff3159e328a940aa (patch)
treefece234ddc6f485bf0b02670eff3fedb48e04d0d
parent9ee7c69da24f189fdb2f40f0d66388db18533ab9 (diff)
downloademacs-97b83d9daa6e84b4ea23413dff3159e328a940aa.tar.gz
emacs-97b83d9daa6e84b4ea23413dff3159e328a940aa.zip
(rlogin-initially-track-cwd): New variable.
(rlogin): Use it to determine whether enable directory tracking via ange-ftp. (rlogin-mode): Make `comint-filename-prefix' local here. (rlogin): Arguments to function are now a string with multiple words (hostname first) and an optional prefix. (rlogin-with-args): Function deleted. (rlogin): Set process filter after calling `rlogin-mode' since the latter called `comint-mode', which sets its own initial process filter.
-rw-r--r--lisp/rlogin.el86
1 files changed, 44 insertions, 42 deletions
diff --git a/lisp/rlogin.el b/lisp/rlogin.el
index d9934147b78..8e5ecc5645d 100644
--- a/lisp/rlogin.el
+++ b/lisp/rlogin.el
@@ -23,6 +23,11 @@
23;;; Commentary: 23;;; Commentary:
24 24
25;; Support for remote logins using `rlogin'. 25;; Support for remote logins using `rlogin'.
26;; $Id$
27
28;;; Todo:
29
30;; Make this mode deal with comint-last-input-end properly.
26 31
27;;; Code: 32;;; Code:
28 33
@@ -50,6 +55,13 @@ Generally it is better not to waste ptys on systems which have a static
50number of them. On the other hand, some implementations of `rlogin' assume 55number of them. On the other hand, some implementations of `rlogin' assume
51a pty is being used, and errors will result from using a pipe instead.") 56a pty is being used, and errors will result from using a pipe instead.")
52 57
58;;;###autoload
59;(setq rlogin-initially-track-cwd nil)
60(defvar rlogin-initially-track-cwd t
61 "*If non-`nil', do remote directory tracking via ange-ftp right away.
62If `nil', you can still enable directory tracking by doing
63`M-x dirtrack-toggle'.")
64
53;; Leave this nil because it makes rlogin-filter a tiny bit faster. Plus 65;; Leave this nil because it makes rlogin-filter a tiny bit faster. Plus
54;; you can still call rlogin-password by hand. 66;; you can still call rlogin-password by hand.
55;;;###autoload 67;;;###autoload
@@ -69,27 +81,35 @@ the minibuffer using the command `rlogin-password' explicitly.")
69 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D))) 81 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D)))
70 82
71;;;###autoload 83;;;###autoload
72(defun rlogin (&optional prefix host) 84(defun rlogin (input-args &optional prefix)
73 "Open a network login connection to HOST via the `rlogin' program. 85 "Open a network login connection to HOST via the `rlogin' program.
74Input is sent line-at-a-time to the remote connection. 86Input is sent line-at-a-time to the remote connection.
75 87
76Communication with HOST is recorded in a buffer *rlogin-HOST*. 88Communication with the remote host is recorded in a buffer *rlogin-HOST*,
77If a prefix argument is given and the buffer *rlogin-HOST* already exists, 89where HOST is the first word in the string ARGS. If a prefix argument is
78a new buffer with a different connection will be made. 90given and the buffer *rlogin-HOST* already exists, a new buffer with a
91different connection will be made.
79 92
80The variable `rlogin-program' contains the name of the actual program to 93The variable `rlogin-program' contains the name of the actual program to
81run. It can be a relative or absolute path. 94run. It can be a relative or absolute path.
82 95
83The variable `rlogin-explicit-args' is a list of arguments to give to 96The variable `rlogin-explicit-args' is a list of arguments to give to
84the rlogin when starting." 97the rlogin when starting. They are added after any arguments given in ARGS."
85 (interactive (list current-prefix-arg 98 (interactive (list (read-from-minibuffer "rlogin arguments (hostname first): ")
86 (read-from-minibuffer "Open rlogin connection to host: "))) 99 current-prefix-arg))
87 (let* ((process-connection-type rlogin-process-connection-type) 100 (let* ((process-connection-type rlogin-process-connection-type)
88 (buffer-name (format "*rlogin-%s*" host)) 101 (buffer-name (format "*rlogin-%s*" input-args))
89 (args (if (and rlogin-explicit-args (listp rlogin-explicit-args)) 102 args
90 (cons host rlogin-explicit-args) 103 proc
91 (list host))) 104 (old-match-data (match-data)))
92 proc) 105 (while (string-match "[ \t]*\\([^ \t]+\\)$" input-args)
106 (setq args
107 (cons (substring input-args (match-beginning 1) (match-end 1))
108 args)
109 input-args (substring input-args 0 (match-beginning 0))))
110 (store-match-data old-match-data)
111 (setq buffer-name (format "*rlogin-%s*" (car args))
112 args (append args rlogin-explicit-args))
93 (and prefix (setq buffer-name 113 (and prefix (setq buffer-name
94 (buffer-name (generate-new-buffer buffer-name)))) 114 (buffer-name (generate-new-buffer buffer-name))))
95 (switch-to-buffer buffer-name) 115 (switch-to-buffer buffer-name)
@@ -101,37 +121,17 @@ the rlogin when starting."
101 ;; Set process-mark to point-max in case there is text in the 121 ;; Set process-mark to point-max in case there is text in the
102 ;; buffer from a previous exited process. 122 ;; buffer from a previous exited process.
103 (set-marker (process-mark proc) (point-max)) 123 (set-marker (process-mark proc) (point-max))
104 (set-process-filter proc 'rlogin-filter)
105 (rlogin-mode) 124 (rlogin-mode)
106 ;; Set the prefix for filename completion and directory tracking 125 ;; Set this *after* running rlogin-mode because rlogin-mode calls
107 ;; to find the remote machine's files by ftp. 126 ;; shell-mode, which munges the process filter.
108 (set (make-local-variable 'comint-filename-prefix) 127 (set-process-filter proc 'rlogin-filter)
109 (concat "/" host ":")) 128 ;; Set the prefix for filename completion and directory tracking
110 ;; Presume the user will start in his remote home directory. 129 ;; to find the remote machine's files by ftp.
111 ;; If this is wrong, M-x dirs will fix it. 130 (setq comint-filename-prefix (concat "/" (car args) ":"))
112 (cd-absolute (concat "/" host ":~/")) 131 (and rlogin-initially-track-cwd
113 )))) 132 ;; Presume the user will start in his remote home directory.
114 133 ;; If this is wrong, M-x dirs will fix it.
115;;;###autoload 134 (cd-absolute (concat "/" (car args) ":~/")))))))
116(defun rlogin-with-args (host args)
117 "Open a new rlogin connection to HOST, even if one already exists.
118String ARGS is given as arguments to the `rlogin' program, overriding the
119value of `rlogin-explicit-args'."
120 (interactive (list (read-from-minibuffer "Open rlogin connection to host: ")
121 (read-from-minibuffer "with arguments: ")))
122 (let ((old-match-data (match-data))
123 (rlogin-explicit-args nil))
124 (unwind-protect
125 (progn
126 (while (string-match "[ \t]*\\([^ \t]+\\)$" args)
127 (setq rlogin-explicit-args
128 (cons (substring args
129 (match-beginning 1)
130 (match-end 1))
131 rlogin-explicit-args)
132 args (substring args 0 (match-beginning 0)))))
133 (store-match-data old-match-data))
134 (rlogin 1 host)))
135 135
136;;;###autoload 136;;;###autoload
137(defun rlogin-password (&optional proc) 137(defun rlogin-password (&optional proc)
@@ -165,6 +165,8 @@ If `rlogin-mode-hook' is set, run it."
165 (setq major-mode 'rlogin-mode) 165 (setq major-mode 'rlogin-mode)
166 (setq mode-name "rlogin") 166 (setq mode-name "rlogin")
167 (use-local-map rlogin-mode-map) 167 (use-local-map rlogin-mode-map)
168 (setq shell-dirtrackp rlogin-initially-track-cwd)
169 (make-local-variable 'comint-filename-prefix)
168 (run-hooks 'rlogin-mode-hook)) 170 (run-hooks 'rlogin-mode-hook))
169 171
170 172