annotate lisp/rlogin.el @ 10469:2546bad34200

(do-auto-fill): Fill, don't fill, or fill-and-justify depending on setting of justification text-property. Respect left-margin and right-margin text properties. (open-line, indent-new-comment-line): Inherit when inserting. (newline-and-indent, reindent-then-newline-and-indent): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Thu, 19 Jan 1995 04:21:56 +0000
parents 1d0a7f841ffb
children eb6af491e98f
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
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
7 ;; Copyright (C) 1992, 1993, 1994, 1995 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
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
23 ;; $Id$
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
24
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
25 ;;; Commentary:
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2259
diff changeset
26
2387
cb44857cab89 moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents: 2315
diff changeset
27 ;; Support for remote logins using `rlogin'.
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
28 ;; This program is layered on top of shell.el; the code here only accounts
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
29 ;; for the variations needed to handle a remote process, e.g. directory
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
30 ;; tracking and the sending of some special characters.
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
31
7922
8fcef41c85b7 (rlogin-password-paranoia): Variable deleted.
Noah Friedman <friedman@splode.com>
parents: 5793
diff changeset
32 ;; 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
33 ;; 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
34 ;; 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
35 ;; `comint-output-filter-functions'.
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
36
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
37 ;;; Code:
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
38
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39 (require 'comint)
4685
3bf9019e5c39 require 'shell
Noah Friedman <friedman@splode.com>
parents: 4678
diff changeset
40 (require 'shell)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
41
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42 (defvar rlogin-program "rlogin"
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
43 "*Name of program to invoke rlogin")
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
44
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
45 (defvar rlogin-explicit-args nil
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
46 "*List of arguments to pass to rlogin on the command line.")
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
47
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48 (defvar rlogin-mode-hook nil
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49 "*Hooks to run after setting current buffer to rlogin-mode.")
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
51 (defvar rlogin-process-connection-type nil
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
52 "*If non-`nil', use a pty for the local rlogin process.
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
53 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
54
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
55 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
56 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
57 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
58
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
59 (defvar rlogin-directory-tracking-mode 'local
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.
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
61
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
62 nil means don't do directory tracking.
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
63
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
64 t means do so using an ftp remote file name.
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
65
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
66 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
67 This works only if the remote machine and the local one
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
68 share the same directories (through NFS). This is the default.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
69
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
70 This variable becomes local to a buffer when set in any fashion for it.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
71
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
72 It is better to use the function of the same name to change the behavior of
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
73 directory tracking in an rlogin session once it has begun, rather than
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
74 simply setting this variable, since the function does the necessary
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
75 re-synching of directories.")
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
76
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
77 (make-variable-buffer-local 'rlogin-directory-tracking-mode)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
78
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
79 (defvar rlogin-host nil
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
80 "*The name of the remote host. This variable is buffer-local.")
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
81
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
82 (defvar rlogin-remote-user nil
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
83 "*The username used on the remote host.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
84 This variable is buffer-local and defaults to your local user name.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
85 If rlogin is invoked with the `-l' option to specify the remote username,
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
86 this variable is set from that.")
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
87
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
88 ;; Initialize rlogin mode map.
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
89 (defvar rlogin-mode-map '())
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
90 (cond
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
91 ((null rlogin-mode-map)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
92 (setq rlogin-mode-map (if (consp shell-mode-map)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
93 (cons 'keymap shell-mode-map)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
94 (copy-keymap shell-mode-map)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
95 (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
96 (define-key rlogin-mode-map "\C-c\C-d" 'rlogin-send-Ctrl-D)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
97 (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
98 (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
99 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
100 (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete)))
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
101
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
102
2387
cb44857cab89 moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents: 2315
diff changeset
103 ;;;###autoload
4856
896f3b49b53c (rlogin-initially-track-cwd): New variable.
Noah Friedman <friedman@splode.com>
parents: 4685
diff changeset
104 (defun rlogin (input-args &optional prefix)
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
105 "Open a network login connection to HOST via the `rlogin' program.
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
106 Input is sent line-at-a-time to the remote connection.
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
107
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
108 Communication with the remote host is recorded in a buffer *rlogin-HOST*
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
109 \(or *rlogin-USER@HOST* if the remote username differs\).
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
110 If a prefix argument is given and the buffer *rlogin-HOST* already exists,
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
111 a new buffer with a different connection will be made.
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
112
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
113 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
114 run. It can be a relative or absolute path.
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
115
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
116 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
117 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
118 INPUT-ARGS.
9250
7cf726dccf2e (rlogin): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8917
diff changeset
119
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
120 If the default value of `rlogin-directory-tracking-mode' is t, then the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
121 default directory in that buffer is set to a remote (FTP) file name to
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
122 access your home directory on the remote machine. Occasionally this causes
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
123 an error, if you cannot access the home directory on that machine. This
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
124 error is harmless as long as you don't try to use that default directory.
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
125
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
126 If `rlogin-directory-tracking-mode' is neither t nor nil, then the default
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
127 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
128 This is useful if the remote machine and your local machine
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
129 share the same files via NFS. This is the default.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
130
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
131 If you wish to change directory tracking styles during a session, use the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
132 function `rlogin-directory-tracking-mode' rather than simply setting the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
133 variable."
8917
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
134 (interactive (list
de32691e953c * rlogin.el (rlogin): recognise the `-l user' option to rlogin and
Francesco Potortì <pot@gnu.org>
parents: 7922
diff changeset
135 (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
136 current-prefix-arg))
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
137
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
138 (let* ((process-connection-type rlogin-process-connection-type)
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
139 (args (if rlogin-explicit-args
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
140 (append (rlogin-parse-words input-args)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
141 rlogin-explicit-args)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
142 (rlogin-parse-words input-args)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
143 (host (car args))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
144 (user (or (car (cdr (member "-l" args)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
145 (user-login-name)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
146 (buffer-name (if (string= user (user-login-name))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
147 (format "*rlogin-%s*" host)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
148 (format "*rlogin-%s@%s*" user host)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
149 proc)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
150
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
151 (cond
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
152 ((and (null prefix)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
153 (comint-check-proc buffer-name))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
154 (switch-to-buffer buffer-name))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
155 ;; This next case is done all in the predicate (including side effects
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
156 ;; like switch-to-buffer) to avoid extra string consing via multiple
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
157 ;; concats.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
158 ((and (numberp prefix)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
159 (let ((bufname (concat buffer-name "<" prefix ">")))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
160 (and (comint-check-proc bufname)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
161 (switch-to-buffer bufname)))))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
162 (t
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
163 (cond
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
164 ((numberp prefix)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
165 (setq buffer-name (concat buffer-name "<" prefix ">")))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
166 (t
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
167 (setq buffer-name (generate-new-buffer-name buffer-name))))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
168 (switch-to-buffer buffer-name)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
169 (comint-exec (current-buffer) buffer-name rlogin-program nil args)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
170 (setq proc (get-process buffer-name))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
171 ;; Set process-mark to point-max in case there is text in the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
172 ;; buffer from a previous exited process.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
173 (set-marker (process-mark proc) (point-max))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
174 (rlogin-mode)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
175
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
176 ;; comint-output-filter-functions is just like a hook, except that the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
177 ;; functions in that list are passed arguments. add-hook serves well
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
178 ;; enough for modifying it.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
179 (add-hook 'comint-output-filter-functions 'rlogin-carriage-filter)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
180
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
181 (make-local-variable 'rlogin-host)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
182 (setq rlogin-host host)
10384
1d0a7f841ffb rlogin-tab-or-complete: insert tab in buffer, don't send directly to process.
Noah Friedman <friedman@splode.com>
parents: 10374
diff changeset
183 (make-local-variable 'rlogin-remote-user)
1d0a7f841ffb rlogin-tab-or-complete: insert tab in buffer, don't send directly to process.
Noah Friedman <friedman@splode.com>
parents: 10374
diff changeset
184 (setq rlogin-remote-user user)
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
185
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
186 (cond
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
187 ((eq rlogin-directory-tracking-mode t)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
188 ;; Do this here, rather than calling the tracking mode function, to
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
189 ;; avoid a gratuitous resync check; the default should be the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
190 ;; user's home directory, be it local or remote.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
191 (setq comint-file-name-prefix
10384
1d0a7f841ffb rlogin-tab-or-complete: insert tab in buffer, don't send directly to process.
Noah Friedman <friedman@splode.com>
parents: 10374
diff changeset
192 (concat "/" rlogin-remote-user "@" rlogin-host ":"))
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
193 (cd-absolute comint-file-name-prefix))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
194 ((null rlogin-directory-tracking-mode))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
195 (t
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
196 (cd-absolute (concat comint-file-name-prefix "~/"))))))))
10130
2fb93cbc2d87 (rlogin-initially-track-cwd): Now a 3-way flag.
Richard M. Stallman <rms@gnu.org>
parents: 9250
diff changeset
197
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
198 (defun rlogin-mode ()
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
199 "Set major-mode for rlogin sessions.
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
200 If `rlogin-mode-hook' is set, run it."
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
201 (interactive)
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
202 (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
203 (shell-mode)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
204 (setq major-mode 'rlogin-mode)
2404
845db675b3e9 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2387
diff changeset
205 (setq mode-name "rlogin")
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
206 (use-local-map rlogin-mode-map)
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
207 (setq shell-dirtrackp rlogin-directory-tracking-mode)
4874
20154e6389eb (rlogin, rlogin-mode): Use comint-file-name-prefix,
Richard M. Stallman <rms@gnu.org>
parents: 4856
diff changeset
208 (make-local-variable 'comint-file-name-prefix)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
209 (run-hooks 'rlogin-mode-hook))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
210
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
211 (defun rlogin-directory-tracking-mode (&optional prefix)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
212 "Do remote or local directory tracking, or disable entirely.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
213
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
214 If called with no prefix argument or a unspecified prefix argument (just
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
215 ``\\[universal-argument]'' with no number) do remote directory tracking via
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
216 ange-ftp. If called as a function, give it no argument.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
217
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
218 If called with a negative prefix argument, disable directory tracking
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
219 entirely.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
220
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
221 If called with a positive, numeric prefix argument, e.g.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
222 ``\\[universal-argument] 1 M-x rlogin-directory-tracking-mode\'',
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
223 then do directory tracking but assume the remote filesystem is the same as
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
224 the local system. This only works in general if the remote machine and the
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
225 local one share the same directories (through NFS)."
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
226 (interactive "P")
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
227 (cond
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
228 ((or (null prefix)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
229 (consp prefix))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
230 (setq rlogin-directory-tracking-mode t)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
231 (setq shell-dirtrack-p t)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
232 (setq comint-file-name-prefix
10384
1d0a7f841ffb rlogin-tab-or-complete: insert tab in buffer, don't send directly to process.
Noah Friedman <friedman@splode.com>
parents: 10374
diff changeset
233 (concat "/" rlogin-remote-user "@" rlogin-host ":")))
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
234 ((< prefix 0)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
235 (setq rlogin-directory-tracking-mode nil)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
236 (setq shell-dirtrack-p nil))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
237 (t
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
238 (setq rlogin-directory-tracking-mode 'local)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
239 (setq comint-file-name-prefix "")
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
240 (setq shell-dirtrack-p t)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
241 (cond
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
242 (shell-dirtrack-p
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
243 (let* ((proc (get-buffer-process (current-buffer)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
244 (proc-mark (process-mark proc))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
245 (current-input (buffer-substring proc-mark (point-max)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
246 (orig-point (point))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
247 (offset (and (>= orig-point proc-mark)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
248 (- (point-max) orig-point))))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
249 (unwind-protect
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
250 (progn
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
251 (delete-region proc-mark (point-max))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
252 (goto-char (point-max))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
253 (shell-resync-dirs))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
254 (goto-char proc-mark)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
255 (insert current-input)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
256 (if offset
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
257 (goto-char (- (point-max) offset))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
258 (goto-char orig-point)))))))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
259
2539
577c77cfd199 *** empty log message ***
Noah Friedman <friedman@splode.com>
parents: 2405
diff changeset
260
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
261 ;; Parse a line into its constituent parts (words separated by
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
262 ;; whitespace). Return a list of the words.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
263 (defun rlogin-parse-words (line)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
264 (let ((list nil)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
265 (posn 0)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
266 (match-data (match-data)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
267 (while (string-match "[^ \t\n]+" line posn)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
268 (setq list (cons (substring line (match-beginning 0) (match-end 0))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
269 list))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
270 (setq posn (match-end 0)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
271 (store-match-data (match-data))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
272 (nreverse list)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
273
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
274 (defun rlogin-carriage-filter (&rest ignored)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
275 ;; When this function is called, the buffer will already have been
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
276 ;; narrowed to the region containing the most recently-inserted text.
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
277 ;; (See `comint-output-filter' in comint.el.)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
278 (let ((point-marker (point-marker)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
279 (goto-char (point-min))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
280 (while (search-forward "\C-m" (point-max) t)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
281 (delete-char -1))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
282 (goto-char point-marker)))
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
283
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
284 (defun rlogin-send-Ctrl-C ()
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
285 (interactive)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
286 (send-string nil "\C-c"))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
287
5792
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
288 (defun rlogin-send-Ctrl-D ()
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
289 (interactive)
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
290 (send-string nil "\C-d"))
242985a124fc Removed many extra autoload cookies.
Roland McGrath <roland@gnu.org>
parents: 5208
diff changeset
291
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
292 (defun rlogin-send-Ctrl-Z ()
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
293 (interactive)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
294 (send-string nil "\C-z"))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
295
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
296 (defun rlogin-send-Ctrl-backslash ()
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
297 (interactive)
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
298 (send-string nil "\C-\\"))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
299
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
300 (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
301 "\
85abf27f701f (rlogin-delchar-or-send-Ctrl-D): Call rlogin-send-Ctrl-D. Doc fix.
Roland McGrath <roland@gnu.org>
parents: 5792
diff changeset
302 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
303 (interactive "p")
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
304 (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
305 (rlogin-send-Ctrl-D)
2231
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
306 (delete-char arg)))
1c7ad2a0f4d9 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
307
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
308 (defun rlogin-tab-or-complete ()
10384
1d0a7f841ffb rlogin-tab-or-complete: insert tab in buffer, don't send directly to process.
Noah Friedman <friedman@splode.com>
parents: 10374
diff changeset
309 "Complete file name if doing directory tracking, or just insert TAB."
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
310 (interactive)
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
311 (if rlogin-directory-tracking-mode
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
312 (comint-dynamic-complete)
10384
1d0a7f841ffb rlogin-tab-or-complete: insert tab in buffer, don't send directly to process.
Noah Friedman <friedman@splode.com>
parents: 10374
diff changeset
313 (insert "\C-i")))
10374
d6de68b87cbd Removed several more gratuitous autoload cookies.
Noah Friedman <friedman@splode.com>
parents: 10130
diff changeset
314
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2231
diff changeset
315 ;;; rlogin.el ends here