aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Friedman1995-02-28 09:51:49 +0000
committerNoah Friedman1995-02-28 09:51:49 +0000
commit2601d12ed96cef83ff4bf57fa63e126fcc1aee19 (patch)
tree4d6eac221eb53b389ea2a31432643d202da9f441
parentc480b1f738fdd1b89785bfa6cff72400dbb08b6c (diff)
downloademacs-2601d12ed96cef83ff4bf57fa63e126fcc1aee19.tar.gz
emacs-2601d12ed96cef83ff4bf57fa63e126fcc1aee19.zip
(rlogin-carriage-filter): Don't assume region is narrowed to most recent
output.
-rw-r--r--lisp/rlogin.el39
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/rlogin.el b/lisp/rlogin.el
index f012e0a9fe7..bef1ecbbd14 100644
--- a/lisp/rlogin.el
+++ b/lisp/rlogin.el
@@ -49,8 +49,8 @@
49 "*Hooks to run after setting current buffer to rlogin-mode.") 49 "*Hooks to run after setting current buffer to rlogin-mode.")
50 50
51(defvar rlogin-process-connection-type nil 51(defvar rlogin-process-connection-type nil
52 "*If non-`nil', use a pty for the local rlogin process. 52 "*If non-`nil', use a pty for the local rlogin process.
53If `nil', use a pipe (if pipes are supported on the local system). 53If `nil', use a pipe (if pipes are supported on the local system).
54 54
55Generally it is better not to waste ptys on systems which have a static 55Generally it is better not to waste ptys on systems which have a static
56number of them. On the other hand, some implementations of `rlogin' assume 56number of them. On the other hand, some implementations of `rlogin' assume
@@ -87,7 +87,7 @@ this variable is set from that.")
87 87
88;; Initialize rlogin mode map. 88;; Initialize rlogin mode map.
89(defvar rlogin-mode-map '()) 89(defvar rlogin-mode-map '())
90(cond 90(cond
91 ((null rlogin-mode-map) 91 ((null rlogin-mode-map)
92 (setq rlogin-mode-map (if (consp shell-mode-map) 92 (setq rlogin-mode-map (if (consp shell-mode-map)
93 (cons 'keymap shell-mode-map) 93 (cons 'keymap shell-mode-map)
@@ -111,7 +111,7 @@ If a prefix argument is given and the buffer *rlogin-HOST* already exists,
111a new buffer with a different connection will be made. 111a new buffer with a different connection will be made.
112 112
113The variable `rlogin-program' contains the name of the actual program to 113The variable `rlogin-program' contains the name of the actual program to
114run. It can be a relative or absolute path. 114run. It can be a relative or absolute path.
115 115
116The variable `rlogin-explicit-args' is a list of arguments to give to 116The variable `rlogin-explicit-args' is a list of arguments to give to
117the rlogin when starting. They are added after any arguments given in 117the rlogin when starting. They are added after any arguments given in
@@ -172,7 +172,7 @@ variable."
172 ;; buffer from a previous exited process. 172 ;; buffer from a previous exited process.
173 (set-marker (process-mark proc) (point-max)) 173 (set-marker (process-mark proc) (point-max))
174 (rlogin-mode) 174 (rlogin-mode)
175 175
176 ;; comint-output-filter-functions is just like a hook, except that the 176 ;; comint-output-filter-functions is just like a hook, except that the
177 ;; functions in that list are passed arguments. add-hook serves well 177 ;; functions in that list are passed arguments. add-hook serves well
178 ;; enough for modifying it. 178 ;; enough for modifying it.
@@ -188,7 +188,7 @@ variable."
188 ;; Do this here, rather than calling the tracking mode function, to 188 ;; Do this here, rather than calling the tracking mode function, to
189 ;; avoid a gratuitous resync check; the default should be the 189 ;; avoid a gratuitous resync check; the default should be the
190 ;; user's home directory, be it local or remote. 190 ;; user's home directory, be it local or remote.
191 (setq comint-file-name-prefix 191 (setq comint-file-name-prefix
192 (concat "/" rlogin-remote-user "@" rlogin-host ":")) 192 (concat "/" rlogin-remote-user "@" rlogin-host ":"))
193 (cd-absolute comint-file-name-prefix)) 193 (cd-absolute comint-file-name-prefix))
194 ((null rlogin-directory-tracking-mode)) 194 ((null rlogin-directory-tracking-mode))
@@ -196,7 +196,7 @@ variable."
196 (cd-absolute (concat comint-file-name-prefix "~/")))))))) 196 (cd-absolute (concat comint-file-name-prefix "~/"))))))))
197 197
198(defun rlogin-mode () 198(defun rlogin-mode ()
199 "Set major-mode for rlogin sessions. 199 "Set major-mode for rlogin sessions.
200If `rlogin-mode-hook' is set, run it." 200If `rlogin-mode-hook' is set, run it."
201 (interactive) 201 (interactive)
202 (kill-all-local-variables) 202 (kill-all-local-variables)
@@ -218,7 +218,7 @@ ange-ftp. If called as a function, give it no argument.
218If called with a negative prefix argument, disable directory tracking 218If called with a negative prefix argument, disable directory tracking
219entirely. 219entirely.
220 220
221If called with a positive, numeric prefix argument, e.g. 221If called with a positive, numeric prefix argument, e.g.
222``\\[universal-argument] 1 M-x rlogin-directory-tracking-mode\'', 222``\\[universal-argument] 1 M-x rlogin-directory-tracking-mode\'',
223then do directory tracking but assume the remote filesystem is the same as 223then do directory tracking but assume the remote filesystem is the same as
224the local system. This only works in general if the remote machine and the 224the local system. This only works in general if the remote machine and the
@@ -229,7 +229,7 @@ local one share the same directories (through NFS)."
229 (consp prefix)) 229 (consp prefix))
230 (setq rlogin-directory-tracking-mode t) 230 (setq rlogin-directory-tracking-mode t)
231 (setq shell-dirtrack-p t) 231 (setq shell-dirtrack-p t)
232 (setq comint-file-name-prefix 232 (setq comint-file-name-prefix
233 (concat "/" rlogin-remote-user "@" rlogin-host ":"))) 233 (concat "/" rlogin-remote-user "@" rlogin-host ":")))
234 ((< prefix 0) 234 ((< prefix 0)
235 (setq rlogin-directory-tracking-mode nil) 235 (setq rlogin-directory-tracking-mode nil)
@@ -238,7 +238,7 @@ local one share the same directories (through NFS)."
238 (setq rlogin-directory-tracking-mode 'local) 238 (setq rlogin-directory-tracking-mode 'local)
239 (setq comint-file-name-prefix "") 239 (setq comint-file-name-prefix "")
240 (setq shell-dirtrack-p t))) 240 (setq shell-dirtrack-p t)))
241 (cond 241 (cond
242 (shell-dirtrack-p 242 (shell-dirtrack-p
243 (let* ((proc (get-buffer-process (current-buffer))) 243 (let* ((proc (get-buffer-process (current-buffer)))
244 (proc-mark (process-mark proc)) 244 (proc-mark (process-mark proc))
@@ -271,13 +271,14 @@ local one share the same directories (through NFS)."
271 (store-match-data (match-data)) 271 (store-match-data (match-data))
272 (nreverse list))) 272 (nreverse list)))
273 273
274(defun rlogin-carriage-filter (&rest ignored) 274(defun rlogin-carriage-filter (string)
275 ;; When this function is called, the buffer will already have been 275 (let* ((point-marker (point-marker))
276 ;; narrowed to the region containing the most recently-inserted text. 276 (end (process-mark (get-buffer-process (current-buffer))))
277 ;; (See `comint-output-filter' in comint.el.) 277 (beg (or (and (boundp 'comint-last-output-start)
278 (let ((point-marker (point-marker))) 278 comint-last-output-start)
279 (goto-char (point-min)) 279 (- end (length string)))))
280 (while (search-forward "\C-m" (point-max) t) 280 (goto-char beg)
281 (while (search-forward "\C-m" end t)
281 (delete-char -1)) 282 (delete-char -1))
282 (goto-char point-marker))) 283 (goto-char point-marker)))
283 284
@@ -299,8 +300,8 @@ local one share the same directories (through NFS)."
299 300
300(defun rlogin-delchar-or-send-Ctrl-D (arg) 301(defun rlogin-delchar-or-send-Ctrl-D (arg)
301 "\ 302 "\
302Delete ARG characters forward, or send a C-d to process if at end of buffer." 303Delete ARG characters forward, or send a C-d to process if at end of buffer."
303 (interactive "p") 304 (interactive "p")
304 (if (eobp) 305 (if (eobp)
305 (rlogin-send-Ctrl-D) 306 (rlogin-send-Ctrl-D)
306 (delete-char arg))) 307 (delete-char arg)))