annotate man/term.texi @ 76:c0c698873ce1 r20-0b33

Import from CVS: tag r20-0b33
author cvs
date Mon, 13 Aug 2007 09:05:10 +0200
parents 376386a54a3c
children 8bec6624d99b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @\input texinfo @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 settitle Notes about emacs Term mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @setfilename ../info/term.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @titlepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @sp 6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @center @titlefont(Notes about Emacs TERM Mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @end titlepage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 @c @format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 @c START-INFO-DIR-ENTRY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 @c * term mode:: Emacs terminal emulator mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 @c END-INFO-DIR-ENTRY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 @c @end format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 @node Top, , (DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 @top Terminal emulator mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 This is some notes about the term Emacs mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 * term mode::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 @node term mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 @chapter Term Mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * Overview::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 * Connecting to remote computers::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 * Paging::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 * Terminal escapes::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 The @code{term} package includes the major modes @code{term},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 @code{shell}, and @code{gud} (for running gbd or another debugger).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 It is a replacement for the comint mode of Emacs 19,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 as well as shell, gdb, terminal, and telnet modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 The package works best with recent releases of Emacs 19,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 but will also work reasonably well with Emacs 18 as well as Lucid Emacs 19.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 The file @code{nshell.el} is a wrapper to use unless term mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 is built into Emacs. If works around some of the missing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 in older Emacs versions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 To use it, edit the paths in @code{nshell.el}, appropriately,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 and then @code{M-x load-file nshell.el RET}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 This will also load in replacement shell and gud modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 @node Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 @section Overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 The @code{term} mode is used to control a program (an "inferior process").
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 It sends most keyboard input characters to the program,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 and displays output from the program in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 This is similar to the traditional comint mode, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 modes derived from it (such as shell and gdb modes).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 You can do with the new term-based shell the same sort
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 of things you could do with the old shell mode,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 using more or less the same interface. However, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 new mode is more flexible, and works somewhat differently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 * Output from the inferior::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 * subbuffer:: The sub-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 * altsubbuffer:: The alternate sub-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 * Input to the inferior::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 @node Output from the inferior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @subsection Output from the inferior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 In typical usage, output from the inferior is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 added to the end of the buffer. If needed, the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 will be scrolled, just like a regular terminal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (Only one line at a time will be scrolled, just like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 regular terminals, and in contrast to the old shell mode.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 Thus the buffer becomes a log of your interaction with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 inferior, just like the old shell mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 Like a real terminal, term maintains a "cursor position."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 This is the @code{process-mark} of the inferior process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 If the process-mark is not at the end of the buffer, output from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 the inferior will overwrite existing text in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 This is like a real terminal, but unlike the old shell mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (which inserts the output, instead of overwriting).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 Some programs (such as Emacs itself) need to control the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 appearance on the screen in detail. They do this by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 sending special control codes. The exact control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 codes needed from terminal to terminal, but nowadays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 most terminals and terminal emulators (including xterm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 understand the so-called "ANSI escape sequences" (first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 popularized by the Digital's VT100 family of terminal).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 The term mode also understands these escape sequences,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 and for each control code does the appropriate thing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 to change the buffer so that the appearance of the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 will match what it would be on a real terminal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (In contrast, the old shell mode doesn't handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 terminal control codes at all.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 See <...> for the specific control codes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 @node subbuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 @subsection The sub-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 A program that talks to terminal expects the terminal to have a fixed size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 If the program is talking a terminal emulator program such as @code{xterm},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 that size can be changed (if the xterm window is re-sized), but programs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 still assume a logical terminal that has a fixed size independent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 of the amount of output transmitted by the programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 To programs that use it, the Emacs terminal emulator acts as if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 too has a fixed size. The @dfn{sub-buffer} is the part of a @code{term}-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 buffer that corresponds to a "normal" terminal. Most of the time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (unless you explicitly scroll the window displaying the buffer),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 the sub-buffer is the part of the buffer that is displayed in a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 The sub-buffer is defined in terms of three buffer-local-variable:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 @defvar term-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 The height of the sub-buffer, in screen lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 @defvar term-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 The width of the sub-buffer, in screen columns.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @defvar term-home-marker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 The "home" position, that is the top left corner of the sub-buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 The sub-buffer is assumed to be the end part of the buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 the @code{term-home-marker} should never be more than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 @code{term-height} screen lines from the end of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @node altsubbuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 @subsection The alternate sub-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 When a "graphical" program finishes, it is nice to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 restore the screen state to what it was before the program started.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 Many people are used to this behavior from @code{xterm}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 its also offered by the @code{term} emulator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 @defun term-switch-to-alternate-sub-buffer set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 If @var{set} is true, and we're not already using the alternate sub-buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 switch to it. What this means is that the @code{term-home-marker}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 is saved (in the variable @code{term-saved-home-marker}), and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 @code{term-home-marker} is set to the end of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 If @var{set} is false and we're using the alternate sub-buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 switch back to the saved sub-buffer. What this means is that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (current, alternate) sub-buffer is deleted (using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 @code{(delete-region term-home-marker (point-max))}), and then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 @code{term-home-marker} is restored (from @code{term-saved-home-marker}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 @node Input to the inferior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 @subsection Input to the inferior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 Characters typed by the user are sent to the inferior.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 How this is done depends on whether the @code{term} buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 is in "character" mode or "line" mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (A @code{term} buffer can also be in "pager" mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 This is discussed <later>.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 Which of these is currently active is specified in the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 The difference between them is the key-bindings available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 In character mode, one character (by default @key{C-c}) is special,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 and is a prefix for various commands. All other characters are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 sent directly to the inferior process, with no interpretation by Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 Character mode looks and feels like a real terminal, or a conventional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 terminal emulator such as xterm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 In line mode, key commands mostly have standard Emacs actions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 Regulars characters insert themselves into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 When return is typed, the entire current line of the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (except possibly the prompt) is sent to the inferior process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 Line mode is basically the original shell mode from earlier Emacs versions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 To switch from line mode to character mode type @kbd{C-c c}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 To switch from character mode to line mode type @kbd{C-c l}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 In either mode, "echoing" of user input is handled by the inferior.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 Therefor, in line mode after an input line at the end of the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 is sent to the inferior, it is deleted from the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 This is so that the inferior can echo the input, if it wishes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (which it normally does).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @node Connecting to remote computers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 @section Connecting to remote computers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 If you want to login to a remove computer, you can do that just as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 you would expect, using whatever commands you would normally use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (This is worth emphasizing, because earlier versions of @code{shell}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 mode would not work properly if you tried to log in to some other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 computer, because of the way echoing was handled. That is why
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 there was a separate @code{telnet} mode to partially compensate for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 these problems. The @code{telnet} mode is no longer needed, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 is basically obsolete.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 A program that asks you for a password will normally suppress
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 echoing of the password, so the password will not show up in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 This will happen just as if you were using a real terminal, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 the buffer is in char mode. If it is in line mode, the password
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 will be temporarily visible, but will be erased when you hit return.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (This happens automatically; there is no special password processing.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 When you log in to a different machine, you need to specify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 type of terminal your using. If you are talking to a Bourne-compatible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 shell, and your system understands the @code{TERMCAP} variable,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 you can use the command @kbd{M-x shell-send-termcap}, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 sends a string specifying the terminal type and size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (This command is also useful after the window has changed size.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 If you need to specify the terminal type manually, you can try the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 terminal types "ansi" or "vt100".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 You can of course run gdb on that remote computer. One useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 trick: If you invoke gdb with the @code{--fullname} option,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 it will send special commands to Emacs that will cause Emacs to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 pop up the source files you're debugging. This will work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 whether or not gdb is running on a different computer than Emacs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 assuming can access the source files specified by gdb.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 @node Paging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 @section Paging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 When the pager is enabled, Emacs will "pause" after each screenful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 of output (since the last input sent to the inferior).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 It will enter "pager" mode, which feels a lot like the "more"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 program: Typing a space requests another screenful of output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 Other commands request more or less output, or scroll backwards
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 in the @code{term} buffer. In pager mode, type @kbd{h} or @kbd{?}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 to display a help message listing all the available pager mode commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 In either character or line mode, type @kbd{C-c p} to enable paging,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 and @kbd{C-c D} to disable it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @node Terminal escapes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 @section Terminal Escape sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 A program that does "graphics" on a terminal controls the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 terminal by sending strings called @dfn{terminal escape sequences}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 that the terminal (or terminal emulator) interprets as special commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 The @code{term} mode includes a terminal emulator that understands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 standard ANSI escape sequences, originally popularized by VT100 terminals,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 and now used by the @code{xterm} program and most modern terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 emulator software.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 * Cursor motion:: Escape sequences to move the cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 * Erasing:: Escape commands for erasing text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 * Inserting and deleting:: Escape sequences to insert and delete text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 * Scrolling:: Escape sequences to scroll part of the visible window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 * Command hook::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 * Miscellaneous escapes::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 printing chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 tab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 LF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 @node Cursor motion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 @subsection Escape sequences to move the cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 @item RETURN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 Moves to the beginning of the current screen line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @item C-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 Moves backwards one column. (Tabs are broken up if needed.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 @comment Line wrap FIXME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 @item Esc [ R ; C H
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 Move to screen row R, screen column C, where (R=1) is the top row,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 and (C=1) is the leftmost column. Defaults are R=1 and C=1.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 @item Esc [ N A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 Move N (default 1) screen lines up.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 @item Esc [ N B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 Move N (default 1) screen lines down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 @item Esc [ N C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 Move N (default 1) columns right.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 @item Esc [ N D
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 Move N (default 1) columns left.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 @node Erasing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 @subsection Escape commands for erasing text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 These commands "erase" part of the sub-buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 Erasing means replacing by white space; it is not the same as deleting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 The relative screen positions of things that are not erased remain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 unchanged with each other, as does the relative cursor position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 @item E [ J
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 Erase from cursor to end of screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 @item E [ 0 J
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 Same as E [ J.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 @item E [ 1 J
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 Erase from home position to point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 @item E [ 2 J
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 Erase whole sub-buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 @item E [ K
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Erase from point to end of screen line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 @item E [ 0 K
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 Same as E [ K.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 @item E [ 1 K
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 Erase from beginning of screen line to point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 @item E [ 2 K
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 Erase whole screen line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 @node Inserting and deleting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 @subsection Escape sequences to insert and delete text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 @item Esc [ N L
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 Insert N (default 1) blank lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 @item Esc [ N M
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 Delete N (default 1) lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 @item Esc [ N P
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 Delete N (default 1) characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 @item Esc [ N @@
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 Insert N (default 1) spaces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 @node Scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 @subsection Escape sequences to scroll part of the visible window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 @item Esc D
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 Scroll forward one screen line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 @item Esc M
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 Scroll backwards one screen line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @item Esc [ T ; B r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 Set the scrolling region to be from lines T down to line B inclusive,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 where line 1 is the topmost line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 @node Command hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 @subsection Command hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 If @kbd{C-z} is seen, any text up to a following @key{LF} is scanned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 The text in between (not counting the initial C-z or the final LF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 is passed to the function that is the value of @code{term-command-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 The default value of the @code{term-command-hook} variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 is the function @code{term-command-hook}, which handles the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 @item C-z C-z FILENAME:LINENUMBER:IGNORED LF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 Set term-pending-frame to @code{(cons "FILENAME" LINENUMBER)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 When the buffer is displayed in the current window, show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 the FILENAME in the other window, and show an arrow at LINENUMBER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 Gdb emits these strings when invoked with the flag --fullname.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 This is used by gdb mode; you can also invoke gdb with this flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 from shell mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 @item C-z / DIRNAME LF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 Set the directory of the term buffer to DIRNAME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 @item C-z ! LEXPR LF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 Read and evaluate LEXPR as a Lisp expression.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 The result is ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 @node Miscellaneous escapes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 @subsection Miscellaneous escapes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 @item C-g (Bell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 Calls @code{(beep t)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 @item Esc 7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 Save cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 @item Esc 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 Restore cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 @item Esc [ 47 h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 Switch to the alternate sub-buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @item Esc [ 47 l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 Switch back to the regular sub-buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 @bye