annotate man/xemacs/misc.texi @ 2881:0e0af7cbfd1b

[xemacs-hg @ 2005-08-01 16:28:18 by darrylo] On some (64-bit) systems, sizeof(int) != sizeof(long), and this can cause crashes because in-use lisp objects can get prematurely gc'd (and 0xdeadbeef'd). This occurs because the memory_description for the Gap_Array structure incorrectly describes some members as XD_INT's (32-bit objects), when they should actually be XD_ELEMCOUNT's and XD_BYTECOUNT's (both 64-bit objects), as that is how they are declared in the structure.
author darrylo
date Mon, 01 Aug 2005 16:28:21 +0000
parents 0f9686ac3ce7
children 7c7262c47538
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 @iftex
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 @chapter Miscellaneous Commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This chapter contains several brief topics that do not fit anywhere else.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 @end iftex
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 @node Sorting, Shell, Calendar/Diary, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 @section Sorting Text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 @cindex sorting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs provides several commands for sorting text in a buffer. All
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 operate on the contents of the region (the text between point and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 mark). They divide the text of the region into many @dfn{sort records},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 identify a @dfn{sort key} for each record, and then reorder the records
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 using the order determined by the sort keys. The records are ordered so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 that their keys are in alphabetical order, or, for numerical sorting, in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 numerical order. In alphabetical sorting, all upper-case letters `A'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 through `Z' come before lower-case `a', in accordance with the ASCII
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 character sequence.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 The sort commands differ in how they divide the text into sort
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 records and in which part of each record they use as the sort key. Most of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 the commands make each line a separate sort record, but some commands use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 paragraphs or pages as sort records. Most of the sort commands use each
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 entire sort record as its own sort key, but some use only a portion of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 record as the sort key.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 @findex sort-lines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 @findex sort-paragraphs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 @findex sort-pages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 @findex sort-fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 @findex sort-numeric-fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 @item M-x sort-lines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 Divide the region into lines and sort by comparing the entire
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 text of a line. A prefix argument means sort in descending order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 @item M-x sort-paragraphs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 Divide the region into paragraphs and sort by comparing the entire
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 text of a paragraph (except for leading blank lines). A prefix
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 argument means sort in descending order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 @item M-x sort-pages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Divide the region into pages and sort by comparing the entire
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 text of a page (except for leading blank lines). A prefix
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 argument means sort in descending order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 @item M-x sort-fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 Divide the region into lines and sort by comparing the contents of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 one field in each line. Fields are defined as separated by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 whitespace, so the first run of consecutive non-whitespace characters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 in a line constitutes field 1, the second such run constitutes field
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 2, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 You specify which field to sort by with a numeric argument: 1 to sort
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 by field 1, etc. A negative argument means sort in descending
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 order. Thus, minus 2 means sort by field 2 in reverse-alphabetical
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 @item M-x sort-numeric-fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 Like @kbd{M-x sort-fields}, except the specified field is converted
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 to a number for each line and the numbers are compared. @samp{10}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 comes before @samp{2} when considered as text, but after it when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 considered as a number.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 @item M-x sort-columns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Like @kbd{M-x sort-fields}, except that the text within each line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 used for comparison comes from a fixed range of columns. An explanation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 is given below.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 For example, if the buffer contains:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 @smallexample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 On systems where clash detection (locking of files being edited) is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 implemented, XEmacs also checks the first time you modify a buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 whether the file has changed on disk since it was last visited or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 saved. If it has, you are asked to confirm that you want to change
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 the buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 @end smallexample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 then if you apply @kbd{M-x sort-lines} to the entire buffer you get:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 @smallexample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 On systems where clash detection (locking of files being edited) is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 implemented, XEmacs also checks the first time you modify a buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 saved. If it has, you are asked to confirm that you want to change
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 the buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 whether the file has changed on disk since it was last visited or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 @end smallexample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 where the upper case `O' comes before all lower case letters. If you apply
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 instead @kbd{C-u 2 M-x sort-fields} you get:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 @smallexample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 saved. If it has, you are asked to confirm that you want to change
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 implemented, XEmacs also checks the first time you modify a buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 the buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 On systems where clash detection (locking of files being edited) is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 whether the file has changed on disk since it was last visited or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 @end smallexample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 where the sort keys were @samp{If}, @samp{XEmacs}, @samp{buffer},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 @samp{systems}, and @samp{the}.@refill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 @findex sort-columns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 @kbd{M-x sort-columns} requires more explanation. You specify the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 columns by putting point at one of the columns and the mark at the other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 column. Because this means you cannot put point or the mark at the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 beginning of the first line to sort, this command uses an unusual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 definition of `region': all of the line point is in is considered part of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 the region, and so is all of the line the mark is in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 For example, to sort a table by information found in columns 10 to 15,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 you could put the mark on column 10 in the first line of the table, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 point on column 15 in the last line of the table, and then use this command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 Or you could put the mark on column 15 in the first line and point on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 column 10 in the last line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 This can be thought of as sorting the rectangle specified by point and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 the mark, except that the text on each line to the left or right of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 rectangle moves along with the text inside the rectangle.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 @xref{Rectangles}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 @node Shell, Narrowing, Sorting, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 @section Running Shell Commands from XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 @cindex subshell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 @cindex shell commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 XEmacs has commands for passing single command lines to inferior shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 processes; it can also run a shell interactively with input and output to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 an XEmacs buffer @samp{*shell*}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 @item M-!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 Run a specified shell command line and display the output
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 (@code{shell-command}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 @item M-|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 Run a specified shell command line with region contents as input;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 optionally replace the region with the output
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 (@code{shell-command-on-region}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 @item M-x shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 Run a subshell with input and output through an XEmacs buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 You can then give commands interactively.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 @item M-x term
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 Run a subshell with input and output through an XEmacs buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 You can then give commands interactively.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 Full terminal emulation is available.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 @menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 * Single Shell:: How to run one shell command and return.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 * Interactive Shell:: Permanent shell taking input via XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 * Shell Mode:: Special XEmacs commands used with permanent shell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 * Terminal emulator:: An XEmacs window as a terminal emulator.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 * Term Mode:: Special XEmacs commands used in Term mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 * Paging in Term:: Paging in the terminal emulator.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 @end menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 @node Single Shell, Interactive Shell, Shell, Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 @subsection Single Shell Commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 @kindex M-!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 @findex shell-command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 @kbd{M-!} (@code{shell-command}) reads a line of text using the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 minibuffer and creates an inferior shell to execute the line as a command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 Standard input from the command comes from the null device. If the shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 command produces any output, the output goes to an XEmacs buffer named
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 @samp{*Shell Command Output*}, which is displayed in another window but not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 selected. A numeric argument, as in @kbd{M-1 M-!}, directs this command to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 insert any output into the current buffer. In that case, point is left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 before the output and the mark is set after the output.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 @kindex M-|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 @findex shell-command-on-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!} but passes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 the contents of the region as input to the shell command, instead of no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 input. If a numeric argument is used to direct output to the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 buffer, then the old region is deleted first and the output replaces it as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 the contents of the region.@refill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 @vindex shell-file-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 @cindex environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 Both @kbd{M-!} and @kbd{M-|} use @code{shell-file-name} to specify the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 shell to use. This variable is initialized based on your @code{SHELL}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 environment variable when you start XEmacs. If the file name does not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 specify a directory, the directories in the list @code{exec-path} are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 searched; this list is initialized based on the @code{PATH} environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 variable when you start XEmacs. You can override either or both of these
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
195 default initializations in your init file. @xref{Init File}.@refill
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 When you use @kbd{M-!} and @kbd{M-|}, XEmacs has to wait until the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 shell command completes. You can quit with @kbd{C-g}; that terminates
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 the shell command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 @node Interactive Shell, Shell Mode, Single Shell, Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 @subsection Interactive Inferior Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 @findex shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 To run a subshell interactively with its typescript in an XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 buffer, use @kbd{M-x shell}. This creates (or reuses) a buffer named
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 @samp{*shell*} and runs a subshell with input coming from and output going
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 to that buffer. That is to say, any ``terminal output'' from the subshell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 will go into the buffer, advancing point, and any ``terminal input'' for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 the subshell comes from text in the buffer. To give input to the subshell,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 go to the end of the buffer and type the input, terminated by @key{RET}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 XEmacs does not wait for the subshell to do anything. You can switch
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 windows or buffers and edit them while the shell is waiting, or while it is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 running a command. Output from the subshell waits until XEmacs has time to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 process it; this happens whenever XEmacs is waiting for keyboard input or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 for time to elapse.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 To get multiple subshells, change the name of buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 @samp{*shell*} to something different by using @kbd{M-x rename-buffer}. The
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 next use of @kbd{M-x shell} creates a new buffer @samp{*shell*} with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 its own subshell. By renaming this buffer as well you can create a third
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 one, and so on. All the subshells run independently and in parallel.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 @vindex explicit-shell-file-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 The file name used to load the subshell is the value of the variable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 @code{explicit-shell-file-name}, if that is non-@code{nil}. Otherwise, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 environment variable @code{ESHELL} is used, or the environment variable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 @code{SHELL} if there is no @code{ESHELL}. If the file name specified
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 is relative, the directories in the list @code{exec-path} are searched
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (@pxref{Single Shell,Single Shell Commands}).@refill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 As soon as the subshell is started, it is sent as input the contents of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 the file @file{~/.emacs_@var{shellname}}, if that file exists, where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 @var{shellname} is the name of the file that the shell was loaded from.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 For example, if you use @code{csh}, the file sent to it is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 @file{~/.emacs_csh}.@refill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 @vindex shell-pushd-regexp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 @vindex shell-popd-regexp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 @vindex shell-cd-regexp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 @code{cd}, @code{pushd}, and @code{popd} commands given to the inferior
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 shell are watched by XEmacs so it can keep the @samp{*shell*} buffer's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 default directory the same as the shell's working directory. These
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 commands are recognized syntactically by examining lines of input that are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 sent. If you use aliases for these commands, you can tell XEmacs to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 recognize them also. For example, if the value of the variable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 @code{shell-pushd-regexp} matches the beginning of a shell command line,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 that line is regarded as a @code{pushd} command. Change this variable when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 you add aliases for @samp{pushd}. Likewise, @code{shell-popd-regexp} and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 @code{shell-cd-regexp} are used to recognize commands with the meaning of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 @samp{popd} and @samp{cd}.@refill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 @kbd{M-x shell-resync-dirs} queries the shell and resynchronizes XEmacs'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 idea of what the current directory stack is. @kbd{M-x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 shell-dirtrack-toggle} turns directory tracking on and off.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 @vindex input-ring-size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 XEmacs keeps a history of the most recent commands you have typed in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 @samp{*shell*} buffer. If you are at the beginning of a shell command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 line and type @key{M-p}, the previous shell input is inserted into the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 buffer before point. Immediately typing @key{M-p} again deletes that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 input and inserts the one before it. By repeating @key{M-p} you can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 move backward through your commands until you find one you want to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 repeat. You may then edit the command before typing @key{RET} if you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 wish. @key{M-n} moves forward through the command history, in case you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 moved backward past the one you wanted while using @key{M-p}. If you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 type the first few characters of a previous command and then type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 @key{M-p}, the most recent shell input starting with those characters is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 inserted. This can be very convenient when you are repeating a sequence
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 of shell commands. The variable @code{input-ring-size} controls how
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 many commands are saved in your input history. The default is 30.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 @node Shell Mode, Terminal emulator, Interactive Shell, Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 @subsection Shell Mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 @cindex Shell mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 The shell buffer uses Shell mode, which defines several special keys
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 attached to the @kbd{C-c} prefix. They are chosen to resemble the usual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 editing and job control characters present in shells that are not under
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 XEmacs, except that you must type @kbd{C-c} first. Here is a list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 of the special key bindings of Shell mode:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 @kindex RET (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 @kindex C-c C-d (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 @kindex C-d (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 @kindex C-c C-u (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 @kindex C-c C-w (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 @kindex C-c C-c (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 @kindex C-c C-z (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 @kindex C-c C-\ (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 @kindex C-c C-o (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 @kindex C-c C-r (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 @kindex C-c C-y (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 @kindex M-p (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 @kindex M-n (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 @kindex TAB (Shell mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 @findex send-shell-input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 @findex shell-send-eof
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 @findex comint-delchar-or-maybe-eof
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 @findex interrupt-shell-subjob
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 @findex stop-shell-subjob
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 @findex quit-shell-subjob
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 @findex kill-output-from-shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 @findex show-output-from-shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 @findex copy-last-shell-input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 @findex comint-previous-input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 @findex comint-next-input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 @findex comint-dynamic-complete
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 @vindex shell-prompt-pattern
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 @item @key{RET}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 At end of buffer send line as input; otherwise, copy current line to end of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 buffer and send it (@code{send-shell-input}). When a line is copied, any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 text at the beginning of the line that matches the variable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 @code{shell-prompt-pattern} is left out; this variable's value should be a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 regexp string that matches the prompts that you use in your subshell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 @item C-c C-d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 Send end-of-file as input, probably causing the shell or its current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 subjob to finish (@code{shell-send-eof}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 @item C-d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 If point is not at the end of the buffer, delete the next character just
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 like most other modes. If point is at the end of the buffer, send
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 end-of-file as input, instead of generating an error as in other modes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 (@code{comint-delchar-or-maybe-eof}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 @item C-c C-u
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 Kill all text that has yet to be sent as input (@code{kill-shell-input}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 @item C-c C-w
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 Kill a word before point (@code{backward-kill-word}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 @item C-c C-c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 Interrupt the shell or its current subjob if any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 (@code{interrupt-shell-subjob}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 @item C-c C-z
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 Stop the shell or its current subjob if any (@code{stop-shell-subjob}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 @item C-c C-\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 Send quit signal to the shell or its current subjob if any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (@code{quit-shell-subjob}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 @item C-c C-o
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 Delete last batch of output from shell (@code{kill-output-from-shell}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 @item C-c C-r
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 Scroll top of last batch of output to top of window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 (@code{show-output-from-shell}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 @item C-c C-y
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 Copy the previous bunch of shell input and insert it into the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 buffer before point (@code{copy-last-shell-input}). No final newline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 is inserted, and the input copied is not resubmitted until you type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 @key{RET}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 @item M-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 Move backward through the input history. Search for a matching command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 if you have typed the beginning of a command (@code{comint-previous-input}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 @item M-n
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 Move forward through the input history. Useful when you are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 using @key{M-p} quickly and go past the desired command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 (@code{comint-next-input}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 @item @key{TAB}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 Complete the file name preceding point (@code{comint-dynamic-complete}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 @node Terminal emulator, Term Mode, Shell Mode, Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 @subsection Interactive Inferior Shell with Terminal Emulator
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 @findex term
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 To run a subshell in a terminal emulator, putting its typescript in an XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 buffer, use @kbd{M-x term}. This creates (or reuses) a buffer named
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 @samp{*term*} and runs a subshell with input coming from your keyboard and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 output going to that buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 All the normal keys that you type are sent without any interpretation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 by XEmacs directly to the subshell, as ``terminal input.''
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 Any ``echo'' of your input is the responsibility of the subshell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 (The exception is the terminal escape character,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 which by default is @kbd{C-c}. @pxref{Term Mode}.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 Any ``terminal output'' from the subshell goes into the buffer,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 advancing point.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 Some programs (such as XEmacs itself) need to control the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 appearance on the terminal screen in detail. They do this by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 sending special control codes. The exact control
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 codes needed vary from terminal to terminal, but nowadays
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 most terminals and terminal emulators (including xterm)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 understand the so-called "ANSI escape sequences" (first
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 popularized by the Digital's VT100 family of terminal).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 The term mode also understands these escape sequences,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 and for each control code does the appropriate thing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 to change the buffer so that the appearance of the window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 will match what it would be on a real terminal.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 Thus you can actually run XEmacs inside an XEmacs Term window!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 XEmacs does not wait for the subshell to do anything. You can switch
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 windows or buffers and edit them while the shell is waiting, or while
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 it is running a command. Output from the subshell waits until XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 has time to process it; this happens whenever XEmacs is waiting for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 keyboard input or for time to elapse.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 To make multiple terminal emulators, rename the buffer @samp{*term*}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 to something different using @kbd{M-x rename-uniquely},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 just as with Shell mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 The file name used to load the subshell is determined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 the same way as for Shell mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 Unlike Shell mode, Term mode does not track the current directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 by examining your input. Instead, if you use a programmable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 shell, you can have it tell Term what the current directory is.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 This is done automatically by bash for version 1.15 and later.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 @node Term Mode, Paging in Term, Terminal emulator, Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 @subsection Term Mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 @cindex Term mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 @cindex mode, Term
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 Term uses Term mode, which has two input modes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 In line mode, Term basically acts like Shell mode. @xref{Shell Mode}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 In Char mode, each character is sent directly to the inferior subshell,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 except for the Term escape character, normally @kbd{C-c}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 To switch between line and char mode, use these commands:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 @table @kbd
936
0f9686ac3ce7 [xemacs-hg @ 2002-07-29 21:52:14 by scop]
scop
parents: 442
diff changeset
420 @kindex C-c C-j @r{(Term mode)}
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 findex term-char-mode
936
0f9686ac3ce7 [xemacs-hg @ 2002-07-29 21:52:14 by scop]
scop
parents: 442
diff changeset
422 @item C-c C-j
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 Switch to line mode. Do nothing if already in line mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
936
0f9686ac3ce7 [xemacs-hg @ 2002-07-29 21:52:14 by scop]
scop
parents: 442
diff changeset
425 @kindex C-c C-k @r{(Term mode)}
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 @findex term-line-mode
936
0f9686ac3ce7 [xemacs-hg @ 2002-07-29 21:52:14 by scop]
scop
parents: 442
diff changeset
427 @item C-c C-k
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 Switch to char mode. Do nothing if already in char mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 The following commands are only available in Char mode:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 @item C-c C-c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 Send a literal @key{C-c} to the sub-shell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 @item C-c C-x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 A prefix command to conveniently access the global @key{C-x} commands.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 For example, @kbd{C-c C-x o} invokes the global binding of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 @kbd{C-x o}, which is normally @samp{other-window}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 @node Paging in Term,, Term Mode, Shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 @subsection Paging in the terminal emulator
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 Term mode has a pager feature. When the pager is enabled,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 term mode will pause at the end of each screenful.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 @kindex C-c C-q @r{(Term mode)}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 @findex term-pager-toggle
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 @item C-c C-q
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 Toggles the pager feature: Disables the pager if it is enabled,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 and vice versa. This works in both line and char modes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 If the pager enabled, the mode-line contains the word @samp{page}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 If the pager is enabled, and Term receives more than a screenful
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 of output since your last input, Term will enter More break mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 This is indicated by @samp{**MORE**} in the mode-line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 Type a @kbd{Space} to display the next screenful of output.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 Type @kbd{?} to see your other options. The interface is similar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 to the Unix @samp{more} program.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 @node Narrowing, Hardcopy, Shell, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 @section Narrowing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 @cindex widening
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 @cindex restriction
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 @cindex narrowing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 @dfn{Narrowing} means focusing in on some portion of the buffer, making
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 the rest temporarily invisible and inaccessible. Cancelling the narrowing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 and making the entire buffer once again visible is called @dfn{widening}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 The amount of narrowing in effect in a buffer at any time is called the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 buffer's @dfn{restriction}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 @c WideCommands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 @item C-x n n
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 Narrow down to between point and mark (@code{narrow-to-region}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 @item C-x n w
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 Widen to make the entire buffer visible again (@code{widen}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 Narrowing sometimes makes it easier to concentrate on a single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 subroutine or paragraph by eliminating clutter. It can also be used to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 restrict the range of operation of a replace command or repeating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 keyboard macro. The word @samp{Narrow} appears in the mode line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 whenever narrowing is in effect. When you have narrowed to a part of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 buffer, that part appears to be all there is. You can't see the rest,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 can't move into it (motion commands won't go outside the visible part),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 and can't change it in any way. However, the invisible text is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 gone; if you save the file, it will be saved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 @kindex C-x n n
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 @findex narrow-to-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 The primary narrowing command is @kbd{C-x n n} (@code{narrow-to-region}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 It sets the current buffer's restrictions so that the text in the current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 region remains visible but all text before the region or after the region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 is invisible. Point and mark do not change.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 Because narrowing can easily confuse users who do not understand it,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 @code{narrow-to-region} is normally a disabled command. Attempting to use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 this command asks for confirmation and gives you the option of enabling it;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 once you enable the command, confirmation will no longer be required. @xref{Disabling}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 @kindex C-x n w
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 @findex widen
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 To undo narrowing, use @kbd{C-x n w} (@code{widen}). This makes all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 text in the buffer accessible again.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 Use the @kbd{C-x =} command to get information on what part of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 buffer you narrowed down. @xref{Position Info}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 @node Hardcopy, Recursive Edit, Narrowing, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 @section Hardcopy Output
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 @cindex hardcopy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 The XEmacs commands for making hardcopy derive their names from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 Unix commands @samp{print} and @samp{lpr}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 @item M-x print-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 Print hardcopy of current buffer using Unix command @samp{print}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 @*(@samp{lpr -p}). This command adds page headings containing the file name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 and page number.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 @item M-x lpr-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 Print hardcopy of current buffer using Unix command @samp{lpr}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 This command does not add page headings.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 @item M-x print-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 Like @code{print-buffer}, but prints only the current region.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 @item M-x lpr-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 Like @code{lpr-buffer}, but prints only the current region.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 @findex print-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 @findex print-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 @findex lpr-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 @findex lpr-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 @vindex lpr-switches
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 All the hardcopy commands pass extra switches to the @code{lpr} program
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 based on the value of the variable @code{lpr-switches}. Its value should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 be a list of strings, each string a switch starting with @samp{-}. For
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 example, the value could be @code{("-Pfoo")} to print on printer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 @samp{foo}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 @node Recursive Edit, Dissociated Press, Hardcopy, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 @section Recursive Editing Levels
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 @cindex recursive editing level
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 @cindex editing level, recursive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 A @dfn{recursive edit} is a situation in which you are using XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 commands to perform arbitrary editing while in the middle of another
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 XEmacs command. For example, when you type @kbd{C-r} inside a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 @code{query-replace}, you enter a recursive edit in which you can change
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 the current buffer. When you exit from the recursive edit, you go back to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 the @code{query-replace}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 @kindex C-M-c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 @findex exit-recursive-edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 @cindex exiting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 @dfn{Exiting} a recursive edit means returning to the unfinished
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 command, which continues execution. For example, exiting the recursive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 edit requested by @kbd{C-r} in @code{query-replace} causes query replacing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 to resume. Exiting is done with @kbd{C-M-c} (@code{exit-recursive-edit}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 @kindex C-]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 @findex abort-recursive-edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 You can also @dfn{abort} a recursive edit. This is like exiting, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 also quits the unfinished command immediately. Use the command @kbd{C-]}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 (@code{abort-recursive-edit}) for this. @xref{Quitting}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 The mode line shows you when you are in a recursive edit by displaying
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 square brackets around the parentheses that always surround the major
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 and minor mode names. Every window's mode line shows the square
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 brackets, since XEmacs as a whole, rather than any particular buffer, is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 in a recursive edit.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 @findex top-level
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 It is possible to be in recursive edits within recursive edits. For
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 example, after typing @kbd{C-r} in a @code{query-replace}, you might
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 type a command that entered the debugger. In such a case, two or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 more sets of square brackets appear in the mode line(s). Exiting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 inner recursive edit (here with the debugger @kbd{c} command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 resumes the query-replace command where it called the debugger. After
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 the end of the query-replace command, you would be able to exit the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 first recursive edit. Aborting exits only one level of recursive edit;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 it returns to the command level of the previous recursive edit. You can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 then abort that one as well.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 The command @kbd{M-x top-level} aborts all levels of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 recursive edits, returning immediately to the top level command reader.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 The text you edit inside the recursive edit need not be the same text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 that you were editing at top level. If the command that invokes the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 recursive edit selects a different buffer first, that is the buffer you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 will edit recursively. You can switch buffers within the recursive edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 in the normal manner (as long as the buffer-switching keys have not been
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 rebound). While you could theoretically do the rest of your editing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 inside the recursive edit, including visiting files, this could have
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 surprising effects (such as stack overflow) from time to time. It is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 best if you always exit or abort a recursive edit when you no longer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 need it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 In general, XEmacs tries to avoid using recursive edits. It is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 usually preferable to allow users to switch among the possible editing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 modes in any order they like. With recursive edits, the only way to get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 to another state is to go ``back'' to the state that the recursive edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 was invoked from.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 @node Dissociated Press, CONX, Recursive Edit, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 @section Dissociated Press
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 @findex dissociated-press
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 @kbd{M-x dissociated-press} is a command for scrambling a file of text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 either word by word or character by character. Starting from a buffer of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 straight English, it produces extremely amusing output. The input comes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 from the current XEmacs buffer. Dissociated Press writes its output in a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 buffer named @samp{*Dissociation*}, and redisplays that buffer after every
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 couple of lines (approximately) to facilitate reading it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 @code{dissociated-press} asks every so often whether to continue
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 operating. Answer @kbd{n} to stop it. You can also stop at any time by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 typing @kbd{C-g}. The dissociation output remains in the @samp{*Dissociation*}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 buffer for you to copy elsewhere if you wish.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 @cindex presidentagon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 Dissociated Press operates by jumping at random from one point in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 buffer to another. In order to produce plausible output rather than
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 gibberish, it insists on a certain amount of overlap between the end of one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 run of consecutive words or characters and the start of the next. That is,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 if it has just printed out `president' and then decides to jump to a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 different point in the file, it might spot the `ent' in `pentagon' and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 continue from there, producing `presidentagon'. Long sample texts produce
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 the best results.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 @cindex againformation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 A positive argument to @kbd{M-x dissociated-press} tells it to operate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 character by character, and specifies the number of overlap characters. A
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 negative argument tells it to operate word by word and specifies the number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 of overlap words. In this mode, whole words are treated as the elements to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 be permuted, rather than characters. No argument is equivalent to an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 argument of two. For your againformation, the output goes only into the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 buffer @samp{*Dissociation*}. The buffer you start with is not changed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 @cindex Markov chain
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 @cindex ignoriginal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 @cindex techniquitous
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 Dissociated Press produces nearly the same results as a Markov chain
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 based on a frequency table constructed from the sample text. It is,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 however, an independent, ignoriginal invention. Dissociated Press
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 techniquitously copies several consecutive characters from the sample
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 between random choices, whereas a Markov chain would choose randomly for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 each word or character. This makes for more plausible sounding results
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 and runs faster.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 @cindex outragedy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 @cindex buggestion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 @cindex properbose
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 It is a mustatement that too much use of Dissociated Press can be a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 developediment to your real work. Sometimes to the point of outragedy.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 And keep dissociwords out of your documentation, if you want it to be well
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 userenced and properbose. Have fun. Your buggestions are welcome.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 @node CONX, Amusements, Dissociated Press, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 @section CONX
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 @cindex random sentences
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 Besides producing a file of scrambled text with Dissociated Press, you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 can generate random sentences by using CONX.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 @item M-x conx
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 Generate random sentences in the @code{*conx*} buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 @item M-x conx-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 Absorb the text in the current buffer into the @code{conx} database.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 @item M-x conx-init
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 Forget the current word-frequency tree.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 @item M-x conx-load
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 Load a @code{conx} database that has been previously saved with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 @code{M-x conx-save}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 @item M-x conx-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 Absorb the text in the current buffer into the @code{conx} database.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 @item M-x conx-save
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 Save the current @code{conx} database to a file for future retrieval.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 @findex conx
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 @findex conx-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 @findex conx-load
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 @findex conx-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 @findex conx-init
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 @findex conx-save
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 Copy text from a buffer using @kbd{M-x conx-buffer} or @kbd{M-x conx-region}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 and then type @kbd{M-x conx}. Output is continuously generated until you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 type @key{^G}. You can save the @code{conx} database to a file with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 @kbd{M-x conx-save}, which you can retrieve with @code{M-x conx-load}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 To clear the database, use @code{M-x conx-init}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 @node Amusements, Emulation, CONX, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 @section Other Amusements
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 @cindex boredom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 @findex hanoi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 @findex yow
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 If you are a little bit bored, you can try @kbd{M-x hanoi}. If you are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 considerably bored, give it a numeric argument. If you are very, very
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 bored, try an argument of 9. Sit back and watch.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 When you are frustrated, try the famous Eliza program. Just do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 @kbd{M-x doctor}. End each input by typing @kbd{RET} twice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 When you are feeling strange, type @kbd{M-x yow}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 @node Emulation, Customization, Amusements, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 @section Emulation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 @cindex other editors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 @cindex vi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 @cindex EDT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 XEmacs can be programmed to emulate (more or less) most other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 editors. Standard facilities can emulate these:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 @table @asis
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 @item Viper (a vi emulator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 @cindex Viper
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 In XEmacs, Viper is the preferred emulation of vi within XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 Viper is designed to allow you to take advantage of the best
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 features of XEmacs while still doing your basic editing in a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 familiar, vi-like fashion. Viper provides various different
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 levels of vi emulation, from a quite complete emulation that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 allows almost no access to native XEmacs commands, to an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 ``expert'' mode that combines the most useful vi commands with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 the most useful XEmacs commands.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 To start Viper, put the command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 (viper-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
743 in your init file. @xref{Init File}.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 Viper comes with a separate manual that is provided standard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 with the XEmacs distribution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 @ignore
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 @item evi (alternative vi emulator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 @cindex evi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 evi is an alternative vi emulator that also provides a nearly complete
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 emulation of vi.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 evi comes with a separate manual that is provided standard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 with the XEmacs distribution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 Warning: loading more than one vi emulator at once may cause name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 conflicts; no one has checked.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 @end ignore
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 @item EDT (DEC VMS editor)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 @findex edt-emulation-on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 @findex edt-emulation-off
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 Turn on EDT emulation with @kbd{M-x edt-emulation-on}. @kbd{M-x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 @*edt-emulation-off} restores normal Emacs command bindings.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 Most of the EDT emulation commands are keypad keys, and most standard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 Emacs key bindings are still available. The EDT emulation rebindings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 are done in the global keymap, so there is no problem switching
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 buffers or major modes while in EDT emulation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 @item Gosling Emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 @findex set-gosmacs-bindings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 @findex set-gnu-bindings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 Turn on emulation of Gosling Emacs (aka Unipress Emacs) with @kbd{M-x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 set-gosmacs-bindings}. This redefines many keys, mostly on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 @kbd{C-x} and @kbd{ESC} prefixes, to work as they do in Gosmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 @kbd{M-x set-gnu-bindings} returns to normal XEmacs by rebinding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 the same keys to the definitions they had at the time @kbd{M-x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 set-gosmacs-bindings} was done.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 It is also possible to run Mocklisp code written for Gosling Emacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 @xref{Mocklisp}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 @end table