annotate man/term.texi @ 345:b2046b8c83c9 r21-1-2

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