annotate lisp/rlogin.el @ 10330:240a2c88d439

(store_function_docstring): Arg is now EMACS_INT.
author Richard M. Stallman <rms@gnu.org>
date Wed, 04 Jan 1995 07:19:10 +0000
parents 2fb93cbc2d87
children d6de68b87cbd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
1 ;;; rlogin.el --- remote login interface
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
2
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
3 ;; Author: Noah Friedman
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
4 ;; Maintainer: Noah Friedman <friedman@prep.ai.mit.edu>
2259
2ba32183ea62 Added keyword.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2233
diff changeset
5 ;; Keywords: unix, comm
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
6
5792
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
7 ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
8 ;;
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
9 ;; This program is free software; you can redistribute it and/or modify
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
12 ;; any later version.
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
13 ;;
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
14 ;; This program is distributed in the hope that it will be useful,
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
17 ;; GNU General Public License for more details.
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
18 ;;
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
19 ;; You should have received a copy of the GNU General Public License
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
20 ;; along with this program; if not, write to: The Free Software Foundation,
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
21 ;; Inc.; 675 Massachusetts Avenue.; Cambridge, MA 02139, USA.
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
23 ;;; Commentary:
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
24
2387
cb44857cab89 moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents: 2315
diff changeset
25 ;; Support for remote logins using `rlogin'.
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
26
7922
8fcef41c85b7 (rlogin-password-paranoia): Variable deleted.
Noah Friedman <friedman@splode.com>
parents: 5793
diff changeset
27 ;; If you wish for rlogin mode to prompt you in the minibuffer for
8fcef41c85b7 (rlogin-password-paranoia): Variable deleted.
Noah Friedman <friedman@splode.com>
parents: 5793
diff changeset
28 ;; passwords when a password prompt appears, just enter m-x send-invisible
8fcef41c85b7 (rlogin-password-paranoia): Variable deleted.
Noah Friedman <friedman@splode.com>
parents: 5793
diff changeset
29 ;; and type in your line, or add `comint-watch-for-password-prompt' to
8fcef41c85b7 (rlogin-password-paranoia): Variable deleted.
Noah Friedman <friedman@splode.com>
parents: 5793
diff changeset
30 ;; `comint-output-filter-functions'.
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
32 ;;; Code:
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
33
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34 (require 'comint)
4685
3bf9019e5c39 require 'shell
Noah Friedman <friedman@splode.com>
parents: 4678
diff changeset
35 (require 'shell)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
36
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
37 ;;;###autoload
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
38 (defvar rlogin-program "rlogin"
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39 "*Name of program to invoke rlogin")
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
41 ;;;###autoload
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
42 (defvar rlogin-explicit-args nil
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
43 "*List of arguments to pass to rlogin on the command line.")
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
44
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
45 ;;;###autoload
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
46 (defvar rlogin-mode-hook nil
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
47 "*Hooks to run after setting current buffer to rlogin-mode.")
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
49 ;;;###autoload
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
50 (defvar rlogin-process-connection-type nil
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
51 "*If non-`nil', use a pty for the local rlogin process.
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
52 If `nil', use a pipe (if pipes are supported on the local system).
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
53
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
54 Generally it is better not to waste ptys on systems which have a static
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
55 number of them. On the other hand, some implementations of `rlogin' assume
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
56 a pty is being used, and errors will result from using a pipe instead.")
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
57
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
58 ;;;###autoload
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
59 (defvar rlogin-initially-track-cwd t
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
60 "*Control whether and how to do directory tracking in an rlogin buffer.
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
61 nil means don't do directory tracking.
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
62 t means do so using an ftp remote file name.
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
63 Any other value means do directory tracking using local file names.
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
64 This works only if the remote machine and the local one
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
65 share the same directories (through NFS).")
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
66
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
67 ;; Initialize rlogin mode map.
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 (defvar rlogin-mode-map '())
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
69 (cond ((not rlogin-mode-map)
4678
cd842296bebf (rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents: 2948
diff changeset
70 (setq rlogin-mode-map (cons 'keymap shell-mode-map))
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
71 (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C)
5792
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
72 (define-key rlogin-mode-map "\C-c\C-d" 'rlogin-send-Ctrl-D)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73 (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
74 (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
75 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D)))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
76
2387
cb44857cab89 moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents: 2315
diff changeset
77 ;;;###autoload
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
78 (defun rlogin (input-args &optional prefix)
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
79 "Open a network login connection to HOST via the `rlogin' program.
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
80 Input is sent line-at-a-time to the remote connection.
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
81
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
82 Communication with the remote host is recorded in a buffer *rlogin-HOST*,
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
83 where HOST is the first word in the string INPUT-ARGS. If a prefix argument is
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
84 given and the buffer *rlogin-HOST* already exists, a new buffer with a
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
85 different connection will be made.
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
86
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
87 The variable `rlogin-program' contains the name of the actual program to
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
88 run. It can be a relative or absolute path.
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
89
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
90 The variable `rlogin-explicit-args' is a list of arguments to give to
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
91 the rlogin when starting. They are added after any arguments given in
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
92 INPUT-ARGS.
9250
7cf726dccf2e (rlogin): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8917
diff changeset
93
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
94 If `rlogin-initially-track-cwd' is t (which is true by default),
9250
7cf726dccf2e (rlogin): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8917
diff changeset
95 then the default directory in that buffer is set to a remote (FTP) file name
7cf726dccf2e (rlogin): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8917
diff changeset
96 to access your home directory on the remote machine. Occasionally
7cf726dccf2e (rlogin): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8917
diff changeset
97 this causes an error, if you cannot access the home directory on that
7cf726dccf2e (rlogin): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8917
diff changeset
98 machine. This error is harmless as long as you don't try to use
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
99 that default directory.
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
100
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
101 If `rlogin-initially-track-cwd' is neither t nor nil, then the default
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
102 directory is initially set up to your (local) home directory.
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
103 This is useful if the remote machine and your local machine
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
104 share the same files via NFS."
8917
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
105 (interactive (list
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
106 (read-from-minibuffer "rlogin arguments (hostname first): ")
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
107 current-prefix-arg))
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
108 (let* ((process-connection-type rlogin-process-connection-type)
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
109 (buffer-name (format "*rlogin-%s*" input-args))
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
110 args
8917
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
111 host
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
112 user
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
113 proc
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
114 (old-match-data (match-data)))
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
115 (while (string-match "[ \t]*\\([^ \t]+\\)$" input-args)
8917
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
116 (setq args (cons (substring input-args
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
117 (match-beginning 1) (match-end 1))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
118 args)
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
119 input-args (substring input-args 0 (match-beginning 0))))
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
120 (store-match-data old-match-data)
8917
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
121 (setq args (append args rlogin-explicit-args))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
122 (setq host (car args))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
123 (let ((tmpargs (cdr args)))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
124 (while (and tmpargs
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
125 (not (string= (car tmpargs) "-l")))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
126 (setq tmpargs (cdr tmpargs)))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
127 (setq user (car (cdr tmpargs))))
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
128 (setq buffer-name (format "*rlogin-%s*" host))
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
129 (and prefix (setq buffer-name
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
130 (buffer-name (generate-new-buffer buffer-name))))
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
131 (switch-to-buffer buffer-name)
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
132 (or (comint-check-proc buffer-name)
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
133 (progn
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
134 (comint-mode)
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
135 (comint-exec (current-buffer) buffer-name rlogin-program nil args)
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
136 (setq proc (get-process buffer-name))
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
137 ;; Set process-mark to point-max in case there is text in the
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
138 ;; buffer from a previous exited process.
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
139 (set-marker (process-mark proc) (point-max))
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
140 (rlogin-mode)
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
141 ;; Set the prefix for filename completion and directory tracking
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
142 ;; to find the remote machine's files by ftp.
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
143 (if (eq rlogin-initially-track-cwd t)
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
144 (setq comint-file-name-prefix (concat "/"
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
145 (and user (concat user "@"))
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
146 host ":")))
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
147 (and rlogin-initially-track-cwd
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
148 ;; Presume the user will start in his remote home directory.
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
149 ;; If this is wrong, M-x dirs will fix it.
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
150 (cd-absolute comint-file-name-prefix))))))
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
151
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
152 (defun rlogin-mode ()
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
153 "Set major-mode for rlogin sessions.
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
154 If `rlogin-mode-hook' is set, run it."
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
155 (interactive)
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
156 (kill-all-local-variables)
4678
cd842296bebf (rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents: 2948
diff changeset
157 (shell-mode)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
158 (setq major-mode 'rlogin-mode)
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
159 (setq mode-name "rlogin")
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
160 (use-local-map rlogin-mode-map)
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
161 (setq shell-dirtrackp rlogin-initially-track-cwd)
4874
20154e6389eb (rlogin, rlogin-mode): Use comint-file-name-prefix,
Richard M. Stallman <rms@gnu.org>
parents: 4856
diff changeset
162 (make-local-variable 'comint-file-name-prefix)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
163 (run-hooks 'rlogin-mode-hook))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
164
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
165
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166 (defun rlogin-send-Ctrl-C ()
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
167 (interactive)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
168 (send-string nil "\C-c"))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
169
5792
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
170 (defun rlogin-send-Ctrl-D ()
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
171 (interactive)
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
172 (send-string nil "\C-d"))
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
173
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
174 (defun rlogin-send-Ctrl-Z ()
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
175 (interactive)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
176 (send-string nil "\C-z"))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
177
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
178 (defun rlogin-send-Ctrl-backslash ()
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
179 (interactive)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
180 (send-string nil "\C-\\"))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
181
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
182 (defun rlogin-delchar-or-send-Ctrl-D (arg)
5793
85abf27f701f (rlogin-delchar-or-send-Ctrl-D): Call rlogin-send-Ctrl-D. Doc fix.
Roland McGrath <roland@gnu.org>
parents: 5792
diff changeset
183 "\
85abf27f701f (rlogin-delchar-or-send-Ctrl-D): Call rlogin-send-Ctrl-D. Doc fix.
Roland McGrath <roland@gnu.org>
parents: 5792
diff changeset
184 Delete ARG characters forward, or send a C-d to process if at end of buffer."
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
185 (interactive "p")
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
186 (if (eobp)
5793
85abf27f701f (rlogin-delchar-or-send-Ctrl-D): Call rlogin-send-Ctrl-D. Doc fix.
Roland McGrath <roland@gnu.org>
parents: 5792
diff changeset
187 (rlogin-send-Ctrl-D)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
188 (delete-char arg)))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
189
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
190 ;;; rlogin.el ends here