1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents the XEmacs editor.
11 Copyright (C) 1985, 1986, 1988 Richard M. Stallman. Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc. Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc. Copyright (C) 1995 Amdahl Corporation.
15 Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
19 Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
26 Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
33 File: xemacs.info, Node: Diary Customizing, Next: Hebrew/Islamic Entries, Prev: Daylight Savings, Up: Calendar Customization
38 Ordinarily, the mode line of the diary buffer window indicates any
39 holidays that fall on the date of the diary entries. The process of
40 checking for holidays can take several seconds, so including holiday
41 information delays the display of the diary buffer noticeably. If you'd
42 prefer to have a faster display of the diary buffer but without the
43 holiday information, set the variable `holidays-in-diary-buffer' to
46 The variable `number-of-diary-entries' controls the number of days
47 of diary entries to be displayed at one time. It affects the initial
48 display when `view-diary-entries-initially' is `t', as well as the
49 command `M-x diary'. For example, the default value is 1, which says
50 to display only the current day's diary entries. If the value is 2,
51 both the current day's and the next day's entries are displayed. The
52 value can also be a vector of seven elements: for example, if the value
53 is `[0 2 2 2 2 4 1]' then no diary entries appear on Sunday, the
54 current date's and the next day's diary entries appear Monday through
55 Thursday, Friday through Monday's entries appear on Friday, while on
56 Saturday only that day's entries appear.
58 The variable `print-diary-entries-hook' is a normal hook run after
59 preparation of a temporary buffer containing just the diary entries
60 currently visible in the diary buffer. (The other, irrelevant diary
61 entries are really absent from the temporary buffer; in the diary
62 buffer, they are merely hidden.) The default value of this hook does
63 the printing with the command `lpr-buffer'. If you want to use a
64 different command to do the printing, just change the value of this
65 hook. Other uses might include, for example, rearranging the lines into
66 order by day and time.
68 You can customize the form of dates in your diary file, if neither
69 the standard American nor European styles suits your needs, by setting
70 the variable `diary-date-forms'. This variable is a list of patterns
71 for recognizing a date. Each date pattern is a list whose elements may
72 be regular expressions (*note Regexps::) or the symbols `month', `day',
73 `year', `monthname', and `dayname'. All these elements serve as
74 patterns that match certain kinds of text in the diary file. In order
75 for the date pattern, as a whole, to match, all of its elements must
78 A regular expression in a date pattern matches in its usual fashion,
79 using the standard syntax table altered so that `*' is a word
82 The symbols `month', `day', `year', `monthname', and `dayname' match
83 the month number, day number, year number, month name, and day name of
84 the date being considered. The symbols that match numbers allow
85 leading zeros; those that match names allow three-letter abbreviations
86 and capitalization. All the symbols can match `*'; since `*' in a
87 diary entry means "any day", "any month", and so on, it should match
88 regardless of the date being considered.
90 The default value of `diary-date-forms' in the American style is
93 ((month "/" day "[^/0-9]")
94 (month "/" day "/" year "[^0-9]")
95 (monthname " *" day "[^,0-9]")
96 (monthname " *" day ", *" year "[^0-9]")
99 Emacs matches of the diary entries with the date forms is done with the
100 standard syntax table from Fundamental mode (*note Syntax Tables:
101 (lispref)Syntax Tables.), but with the `*' changed so that it is a word
104 The date patterns in the list must be _mutually exclusive_ and must
105 not match any portion of the diary entry itself, just the date and one
106 character of whitespace. If, to be mutually exclusive, the pattern
107 must match a portion of the diary entry text--beyond the whitespace
108 that ends the date--then the first element of the date pattern _must_
109 be `backup'. This causes the date recognizer to back up to the
110 beginning of the current word of the diary entry, after finishing the
111 match. Even if you use `backup', the date pattern must absolutely not
112 match more than a portion of the first word of the diary entry. The
113 default value of `diary-date-forms' in the European style is this list:
115 ((day "/" month "[^/0-9]")
116 (day "/" month "/" year "[^0-9]")
117 (backup day " *" monthname "\\W+\\<[^*0-9]")
118 (day " *" monthname " *" year "[^0-9]")
121 Notice the use of `backup' in the third pattern, because it needs to
122 match part of a word beyond the date itself to distinguish it from the
126 File: xemacs.info, Node: Hebrew/Islamic Entries, Next: Fancy Diary Display, Prev: Diary Customizing, Up: Calendar Customization
128 Hebrew- and Islamic-Date Diary Entries
129 ......................................
131 Your diary file can have entries based on Hebrew or Islamic dates, as
132 well as entries based on the world-standard Gregorian calendar.
133 However, because recognition of such entries is time-consuming and most
134 people don't use them, you must explicitly enable their use. If you
135 want the diary to recognize Hebrew-date diary entries, for example, you
138 (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
139 (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
141 If you want Islamic-date entries, do this:
143 (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
144 (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
146 Hebrew- and Islamic-date diary entries have the same formats as
147 Gregorian-date diary entries, except that `H' precedes a Hebrew date
148 and `I' precedes an Islamic date. Moreover, because the Hebrew and
149 Islamic month names are not uniquely specified by the first three
150 letters, you may not abbreviate them. For example, a diary entry for
151 the Hebrew date Heshvan 25 could look like this:
153 HHeshvan 25 Happy Hebrew birthday!
155 and would appear in the diary for any date that corresponds to Heshvan
156 25 on the Hebrew calendar. And here is Islamic-date diary entry that
157 matches Dhu al-Qada 25:
159 IDhu al-Qada 25 Happy Islamic birthday!
161 and would appear in the diary for any date that corresponds to Dhu
162 al-Qada 25 on the Islamic calendar.
164 As with Gregorian-date diary entries, Hebrew- and Islamic-date
165 entries are nonmarking if they are preceded with an ampersand (`&').
167 Here is a table of commands used in the calendar to create diary
168 entries that match the selected date and other dates that are similar
169 in the Hebrew or Islamic calendar:
172 Add a diary entry for the Hebrew date corresponding to the
173 selected date (`insert-hebrew-diary-entry').
176 Add a diary entry for the day of the Hebrew month corresponding to
177 the selected date (`insert-monthly-hebrew-diary-entry'). This
178 diary entry matches any date that has the same Hebrew
179 day-within-month as the selected date.
182 Add a diary entry for the day of the Hebrew year corresponding to
183 the selected date (`insert-yearly-hebrew-diary-entry'). This diary
184 entry matches any date which has the same Hebrew month and
185 day-within-month as the selected date.
188 Add a diary entry for the Islamic date corresponding to the
189 selected date (`insert-islamic-diary-entry').
192 Add a diary entry for the day of the Islamic month corresponding
193 to the selected date (`insert-monthly-islamic-diary-entry').
196 Add a diary entry for the day of the Islamic year corresponding to
197 the selected date (`insert-yearly-islamic-diary-entry').
199 These commands work much like the corresponding commands for ordinary
200 diary entries: they apply to the date that point is on in the calendar
201 window, and what they do is insert just the date portion of a diary
202 entry at the end of your diary file. You must then insert the rest of
206 File: xemacs.info, Node: Fancy Diary Display, Next: Included Diary Files, Prev: Hebrew/Islamic Entries, Up: Calendar Customization
211 Diary display works by preparing the diary buffer and then running
212 the hook `diary-display-hook'. The default value of this hook
213 (`simple-diary-display') hides the irrelevant diary entries and then
214 displays the buffer. However, if you specify the hook as follows,
216 (add-hook 'diary-display-hook 'fancy-diary-display)
218 this enables fancy diary display. It displays diary entries and
219 holidays by copying them into a special buffer that exists only for the
220 sake of display. Copying to a separate buffer provides an opportunity
221 to change the displayed text to make it prettier--for example, to sort
222 the entries by the dates they apply to.
224 As with simple diary display, you can print a hard copy of the buffer
225 with `print-diary-entries'. To print a hard copy of a day-by-day diary
226 for a week by positioning point on Sunday of that week, type `7 d' and
227 then do `M-x print-diary-entries'. As usual, the inclusion of the
228 holidays slows down the display slightly; you can speed things up by
229 setting the variable `holidays-in-diary-buffer' to `nil'.
231 Ordinarily, the fancy diary buffer does not show days for which
232 there are no diary entries, even if that day is a holiday. If you want
233 such days to be shown in the fancy diary buffer, set the variable
234 `diary-list-include-blanks' to `t'.
236 If you use the fancy diary display, you can use the normal hook
237 `list-diary-entries-hook' to sort each day's diary entries by their
238 time of day. Add this line to your `.emacs' file:
240 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
242 For each day, this sorts diary entries that begin with a recognizable
243 time of day according to their times. Diary entries without times come
244 first within each day.
247 File: xemacs.info, Node: Included Diary Files, Next: Sexp Diary Entries, Prev: Fancy Diary Display, Up: Calendar Customization
252 Fancy diary display also has the ability to process included diary
253 files. This permits a group of people to share a diary file for events
254 that apply to all of them. Lines in the diary file of this form:
258 includes the diary entries from the file FILENAME in the fancy diary
259 buffer. The include mechanism is recursive, so that included files can
260 include other files, and so on; you must be careful not to have a cycle
261 of inclusions, of course. Here is how to enable the include facility:
263 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
264 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
266 The include mechanism works only with the fancy diary display,
267 because ordinary diary display shows the entries directly from your
271 File: xemacs.info, Node: Sexp Diary Entries, Next: Appt Customizing, Prev: Included Diary Files, Up: Calendar Customization
273 Sexp Entries and the Fancy Diary Display
274 ........................................
276 Sexp diary entries allow you to do more than just have complicated
277 conditions under which a diary entry applies. If you use the fancy
278 diary display, sexp entries can generate the text of the entry depending
279 on the date itself. For example, an anniversary diary entry can insert
280 the number of years since the anniversary date into the text of the
281 diary entry. Thus the `%d' in this dairy entry:
283 %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
285 gets replaced by the age, so on October 31, 1990 the entry appears in
286 the fancy diary buffer like this:
288 Arthur's birthday (42 years old)
290 If the diary file instead contains this entry:
292 %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
294 the entry in the fancy diary buffer for October 31, 1990 appears like
297 Arthur's 42nd birthday
299 Similarly, cyclic diary entries can interpolate the number of
300 repetitions that have occurred:
302 %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
306 Renew medication (5th time)
308 in the fancy diary display on September 8, 1990.
310 The generality of sexp diary entries lets you specify any diary entry
311 that you can describe algorithmically. A sexp diary entry contains an
312 expression that computes whether the entry applies to any given date.
313 If its value is non-`nil', the entry applies to that date; otherwise,
314 it does not. The expression can use the variable `date' to find the
315 date being considered; its value is a list (MONTH DAY YEAR) that refers
316 to the Gregorian calendar.
318 Suppose you get paid on the 21st of the month if it is a weekday, and
319 on the Friday before if the 21st is on a weekend. Here is how to write
320 a sexp diary entry that matches those dates:
322 &%%(let ((dayname (calendar-day-of-week date))
323 (day (car (cdr date))))
324 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
325 (and (memq day '(19 20)) (= dayname 5)))
326 ) Pay check deposited
328 applies to just those dates. This example illustrates how the sexp can
329 depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
330 that gives the Gregorian date for which the diary entries are being
331 found. If the value of the expression is `t', the entry applies to
332 that date. If the expression evaluates to `nil', the entry does _not_
335 The following sexp diary entries take advantage of the ability (in
336 the fancy diary display) to concoct diary entries whose text varies
339 `%%(diary-sunrise-sunset)'
340 Make a diary entry for the local times of today's sunrise and
343 `%%(diary-phases-of-moon)'
344 Make a diary entry for the phases (quarters) of the moon.
346 `%%(diary-day-of-year)'
347 Make a diary entry with today's day number in the current year and
348 the number of days remaining in the current year.
351 Make a diary entry with today's equivalent ISO commercial date.
353 `%%(diary-julian-date)'
354 Make a diary entry with today's equivalent date on the Julian
357 `%%(diary-astro-day-number)'
358 Make a diary entry with today's equivalent astronomical (Julian)
361 `%%(diary-hebrew-date)'
362 Make a diary entry with today's equivalent date on the Hebrew
365 `%%(diary-islamic-date)'
366 Make a diary entry with today's equivalent date on the Islamic
369 `%%(diary-french-date)'
370 Make a diary entry with today's equivalent date on the French
371 Revolutionary calendar.
373 `%%(diary-mayan-date)'
374 Make a diary entry with today's equivalent date on the Mayan
377 Thus including the diary entry
379 &%%(diary-hebrew-date)
381 causes every day's diary display to contain the equivalent date on the
382 Hebrew calendar, if you are using the fancy diary display. (With simple
383 diary display, the line `&%%(diary-hebrew-date)' appears in the diary
384 for any date, but does nothing particularly useful.)
386 These functions can be used to construct sexp diary entries based on
387 the Hebrew calendar in certain standard ways:
389 `%%(diary-rosh-hodesh)'
390 Make a diary entry that tells the occurrence and ritual
391 announcement of each new Hebrew month.
394 Make a Saturday diary entry that tells the weekly synagogue
397 `%%(diary-sabbath-candles)'
398 Make a Friday diary entry that tells the _local time_ of Sabbath
402 Make a diary entry that gives the omer count, when appropriate.
404 `%%(diary-yahrzeit MONTH DAY YEAR) NAME'
405 Make a diary entry marking the anniversary of a date of death.
406 The date is the _Gregorian_ (civil) date of death. The diary
407 entry appears on the proper Hebrew calendar anniversary and on the
408 day before. (In the European style, the order of the parameters
409 is changed to DAY, MONTH, YEAR.)
412 File: xemacs.info, Node: Appt Customizing, Prev: Sexp Diary Entries, Up: Calendar Customization
414 Customizing Appointment Reminders
415 .................................
417 You can specify exactly how Emacs reminds you of an appointment, and
418 how far in advance it begins doing so, by setting these variables:
420 `appt-message-warning-time'
421 The time in minutes before an appointment that the reminder
422 begins. The default is 10 minutes.
425 If this is `t' (the default), Emacs rings the terminal bell for
426 appointment reminders.
429 If this is `t' (the default), Emacs displays the appointment
430 message in echo area.
432 `appt-display-mode-line'
433 If this is `t' (the default), Emacs displays the number of minutes
434 to the appointment on the mode line.
437 If this is `t' (the default), Emacs displays the appointment
438 message in another window.
440 `appt-display-duration'
441 The number of seconds an appointment message is displayed. The
442 default is 5 seconds.
445 File: xemacs.info, Node: Sorting, Next: Shell, Prev: Calendar/Diary, Up: Top
450 XEmacs provides several commands for sorting text in a buffer. All
451 operate on the contents of the region (the text between point and the
452 mark). They divide the text of the region into many "sort records",
453 identify a "sort key" for each record, and then reorder the records
454 using the order determined by the sort keys. The records are ordered so
455 that their keys are in alphabetical order, or, for numerical sorting, in
456 numerical order. In alphabetical sorting, all upper-case letters `A'
457 through `Z' come before lower-case `a', in accordance with the ASCII
460 The sort commands differ in how they divide the text into sort
461 records and in which part of each record they use as the sort key.
462 Most of the commands make each line a separate sort record, but some
463 commands use paragraphs or pages as sort records. Most of the sort
464 commands use each entire sort record as its own sort key, but some use
465 only a portion of the record as the sort key.
468 Divide the region into lines and sort by comparing the entire text
469 of a line. A prefix argument means sort in descending order.
471 `M-x sort-paragraphs'
472 Divide the region into paragraphs and sort by comparing the entire
473 text of a paragraph (except for leading blank lines). A prefix
474 argument means sort in descending order.
477 Divide the region into pages and sort by comparing the entire text
478 of a page (except for leading blank lines). A prefix argument
479 means sort in descending order.
482 Divide the region into lines and sort by comparing the contents of
483 one field in each line. Fields are defined as separated by
484 whitespace, so the first run of consecutive non-whitespace
485 characters in a line constitutes field 1, the second such run
486 constitutes field 2, etc.
488 You specify which field to sort by with a numeric argument: 1 to
489 sort by field 1, etc. A negative argument means sort in descending
490 order. Thus, minus 2 means sort by field 2 in reverse-alphabetical
493 `M-x sort-numeric-fields'
494 Like `M-x sort-fields', except the specified field is converted to
495 a number for each line and the numbers are compared. `10' comes
496 before `2' when considered as text, but after it when considered
500 Like `M-x sort-fields', except that the text within each line used
501 for comparison comes from a fixed range of columns. An explanation
504 For example, if the buffer contains:
506 On systems where clash detection (locking of files being edited) is
507 implemented, XEmacs also checks the first time you modify a buffer
508 whether the file has changed on disk since it was last visited or
509 saved. If it has, you are asked to confirm that you want to change
512 then if you apply `M-x sort-lines' to the entire buffer you get:
514 On systems where clash detection (locking of files being edited) is
515 implemented, XEmacs also checks the first time you modify a buffer
516 saved. If it has, you are asked to confirm that you want to change
518 whether the file has changed on disk since it was last visited or
520 where the upper case `O' comes before all lower case letters. If you
521 apply instead `C-u 2 M-x sort-fields' you get:
523 saved. If it has, you are asked to confirm that you want to change
524 implemented, XEmacs also checks the first time you modify a buffer
526 On systems where clash detection (locking of files being edited) is
527 whether the file has changed on disk since it was last visited or
529 where the sort keys were `If', `XEmacs', `buffer', `systems', and `the'.
531 `M-x sort-columns' requires more explanation. You specify the
532 columns by putting point at one of the columns and the mark at the other
533 column. Because this means you cannot put point or the mark at the
534 beginning of the first line to sort, this command uses an unusual
535 definition of `region': all of the line point is in is considered part
536 of the region, and so is all of the line the mark is in.
538 For example, to sort a table by information found in columns 10 to
539 15, you could put the mark on column 10 in the first line of the table,
540 and point on column 15 in the last line of the table, and then use this
541 command. Or you could put the mark on column 15 in the first line and
542 point on column 10 in the last line.
544 This can be thought of as sorting the rectangle specified by point
545 and the mark, except that the text on each line to the left or right of
546 the rectangle moves along with the text inside the rectangle. *Note
550 File: xemacs.info, Node: Shell, Next: Narrowing, Prev: Sorting, Up: Top
552 Running Shell Commands from XEmacs
553 ==================================
555 XEmacs has commands for passing single command lines to inferior
556 shell processes; it can also run a shell interactively with input and
557 output to an XEmacs buffer `*shell*'.
560 Run a specified shell command line and display the output
564 Run a specified shell command line with region contents as input;
565 optionally replace the region with the output
566 (`shell-command-on-region').
569 Run a subshell with input and output through an XEmacs buffer.
570 You can then give commands interactively.
573 Run a subshell with input and output through an XEmacs buffer.
574 You can then give commands interactively. Full terminal emulation
579 * Single Shell:: How to run one shell command and return.
580 * Interactive Shell:: Permanent shell taking input via XEmacs.
581 * Shell Mode:: Special XEmacs commands used with permanent shell.
582 * Terminal emulator:: An XEmacs window as a terminal emulator.
583 * Term Mode:: Special XEmacs commands used in Term mode.
584 * Paging in Term:: Paging in the terminal emulator.
587 File: xemacs.info, Node: Single Shell, Next: Interactive Shell, Prev: Shell, Up: Shell
589 Single Shell Commands
590 ---------------------
592 `M-!' (`shell-command') reads a line of text using the minibuffer
593 and creates an inferior shell to execute the line as a command.
594 Standard input from the command comes from the null device. If the
595 shell command produces any output, the output goes to an XEmacs buffer
596 named `*Shell Command Output*', which is displayed in another window
597 but not selected. A numeric argument, as in `M-1 M-!', directs this
598 command to insert any output into the current buffer. In that case,
599 point is left before the output and the mark is set after the output.
601 `M-|' (`shell-command-on-region') is like `M-!' but passes the
602 contents of the region as input to the shell command, instead of no
603 input. If a numeric argument is used to direct output to the current
604 buffer, then the old region is deleted first and the output replaces it
605 as the contents of the region.
607 Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
608 use. This variable is initialized based on your `SHELL' environment
609 variable when you start XEmacs. If the file name does not specify a
610 directory, the directories in the list `exec-path' are searched; this
611 list is initialized based on the `PATH' environment variable when you
612 start XEmacs. You can override either or both of these default
613 initializations in your `.emacs' file.
615 When you use `M-!' and `M-|', XEmacs has to wait until the shell
616 command completes. You can quit with `C-g'; that terminates the shell
620 File: xemacs.info, Node: Interactive Shell, Next: Shell Mode, Prev: Single Shell, Up: Shell
622 Interactive Inferior Shell
623 --------------------------
625 To run a subshell interactively with its typescript in an XEmacs
626 buffer, use `M-x shell'. This creates (or reuses) a buffer named
627 `*shell*' and runs a subshell with input coming from and output going
628 to that buffer. That is to say, any "terminal output" from the subshell
629 will go into the buffer, advancing point, and any "terminal input" for
630 the subshell comes from text in the buffer. To give input to the
631 subshell, go to the end of the buffer and type the input, terminated by
634 XEmacs does not wait for the subshell to do anything. You can switch
635 windows or buffers and edit them while the shell is waiting, or while
636 it is running a command. Output from the subshell waits until XEmacs
637 has time to process it; this happens whenever XEmacs is waiting for
638 keyboard input or for time to elapse.
640 To get multiple subshells, change the name of buffer `*shell*' to
641 something different by using `M-x rename-buffer'. The next use of `M-x
642 shell' creates a new buffer `*shell*' with its own subshell. By
643 renaming this buffer as well you can create a third one, and so on.
644 All the subshells run independently and in parallel.
646 The file name used to load the subshell is the value of the variable
647 `explicit-shell-file-name', if that is non-`nil'. Otherwise, the
648 environment variable `ESHELL' is used, or the environment variable
649 `SHELL' if there is no `ESHELL'. If the file name specified is
650 relative, the directories in the list `exec-path' are searched (*note
651 Single Shell Commands: Single Shell.).
653 As soon as the subshell is started, it is sent as input the contents
654 of the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME
655 is the name of the file that the shell was loaded from. For example,
656 if you use `csh', the file sent to it is `~/.emacs_csh'.
658 `cd', `pushd', and `popd' commands given to the inferior shell are
659 watched by XEmacs so it can keep the `*shell*' buffer's default
660 directory the same as the shell's working directory. These commands
661 are recognized syntactically by examining lines of input that are sent.
662 If you use aliases for these commands, you can tell XEmacs to
663 recognize them also. For example, if the value of the variable
664 `shell-pushd-regexp' matches the beginning of a shell command line,
665 that line is regarded as a `pushd' command. Change this variable when
666 you add aliases for `pushd'. Likewise, `shell-popd-regexp' and
667 `shell-cd-regexp' are used to recognize commands with the meaning of
670 `M-x shell-resync-dirs' queries the shell and resynchronizes XEmacs'
671 idea of what the current directory stack is. `M-x
672 shell-dirtrack-toggle' turns directory tracking on and off.
674 XEmacs keeps a history of the most recent commands you have typed in
675 the `*shell*' buffer. If you are at the beginning of a shell command
676 line and type <M-p>, the previous shell input is inserted into the
677 buffer before point. Immediately typing <M-p> again deletes that input
678 and inserts the one before it. By repeating <M-p> you can move
679 backward through your commands until you find one you want to repeat.
680 You may then edit the command before typing <RET> if you wish. <M-n>
681 moves forward through the command history, in case you moved backward
682 past the one you wanted while using <M-p>. If you type the first few
683 characters of a previous command and then type <M-p>, the most recent
684 shell input starting with those characters is inserted. This can be
685 very convenient when you are repeating a sequence of shell commands.
686 The variable `input-ring-size' controls how many commands are saved in
687 your input history. The default is 30.
690 File: xemacs.info, Node: Shell Mode, Next: Terminal emulator, Prev: Interactive Shell, Up: Shell
695 The shell buffer uses Shell mode, which defines several special keys
696 attached to the `C-c' prefix. They are chosen to resemble the usual
697 editing and job control characters present in shells that are not under
698 XEmacs, except that you must type `C-c' first. Here is a list of the
699 special key bindings of Shell mode:
702 At end of buffer send line as input; otherwise, copy current line
703 to end of buffer and send it (`send-shell-input'). When a line is
704 copied, any text at the beginning of the line that matches the
705 variable `shell-prompt-pattern' is left out; this variable's value
706 should be a regexp string that matches the prompts that you use in
710 Send end-of-file as input, probably causing the shell or its
711 current subjob to finish (`shell-send-eof').
714 If point is not at the end of the buffer, delete the next
715 character just like most other modes. If point is at the end of
716 the buffer, send end-of-file as input, instead of generating an
717 error as in other modes (`comint-delchar-or-maybe-eof').
720 Kill all text that has yet to be sent as input
721 (`kill-shell-input').
724 Kill a word before point (`backward-kill-word').
727 Interrupt the shell or its current subjob if any
728 (`interrupt-shell-subjob').
731 Stop the shell or its current subjob if any (`stop-shell-subjob').
734 Send quit signal to the shell or its current subjob if any
735 (`quit-shell-subjob').
738 Delete last batch of output from shell (`kill-output-from-shell').
741 Scroll top of last batch of output to top of window
742 (`show-output-from-shell').
745 Copy the previous bunch of shell input and insert it into the
746 buffer before point (`copy-last-shell-input'). No final newline
747 is inserted, and the input copied is not resubmitted until you type
751 Move backward through the input history. Search for a matching
752 command if you have typed the beginning of a command
753 (`comint-previous-input').
756 Move forward through the input history. Useful when you are using
757 <M-p> quickly and go past the desired command
758 (`comint-next-input').
761 Complete the file name preceding point (`comint-dynamic-complete').
764 File: xemacs.info, Node: Terminal emulator, Next: Term Mode, Prev: Shell Mode, Up: Shell
766 Interactive Inferior Shell with Terminal Emulator
767 -------------------------------------------------
769 To run a subshell in a terminal emulator, putting its typescript in
770 an XEmacs buffer, use `M-x term'. This creates (or reuses) a buffer
771 named `*term*' and runs a subshell with input coming from your keyboard
772 and output going to that buffer.
774 All the normal keys that you type are sent without any interpretation
775 by XEmacs directly to the subshell, as "terminal input." Any "echo" of
776 your input is the responsibility of the subshell. (The exception is
777 the terminal escape character, which by default is `C-c'. *note Term
778 Mode::.) Any "terminal output" from the subshell goes into the buffer,
781 Some programs (such as XEmacs itself) need to control the appearance
782 on the terminal screen in detail. They do this by sending special
783 control codes. The exact control codes needed vary from terminal to
784 terminal, but nowadays most terminals and terminal emulators (including
785 xterm) understand the so-called "ANSI escape sequences" (first
786 popularized by the Digital's VT100 family of terminal). The term mode
787 also understands these escape sequences, and for each control code does
788 the appropriate thing to change the buffer so that the appearance of
789 the window will match what it would be on a real terminal. Thus you
790 can actually run XEmacs inside an XEmacs Term window!
792 XEmacs does not wait for the subshell to do anything. You can switch
793 windows or buffers and edit them while the shell is waiting, or while
794 it is running a command. Output from the subshell waits until XEmacs
795 has time to process it; this happens whenever XEmacs is waiting for
796 keyboard input or for time to elapse.
798 To make multiple terminal emulators, rename the buffer `*term*' to
799 something different using `M-x rename-uniquely', just as with Shell
802 The file name used to load the subshell is determined the same way
805 Unlike Shell mode, Term mode does not track the current directory by
806 examining your input. Instead, if you use a programmable shell, you
807 can have it tell Term what the current directory is. This is done
808 automatically by bash for version 1.15 and later.
811 File: xemacs.info, Node: Term Mode, Next: Paging in Term, Prev: Terminal emulator, Up: Shell
816 Term uses Term mode, which has two input modes: In line mode, Term
817 basically acts like Shell mode. *Note Shell Mode::. In Char mode,
818 each character is sent directly to the inferior subshell, except for
819 the Term escape character, normally `C-c'.
821 To switch between line and char mode, use these commands:
822 findex term-char-mode
825 Switch to line mode. Do nothing if already in line mode.
828 Switch to char mode. Do nothing if already in char mode.
830 The following commands are only available in Char mode:
832 Send a literal <C-c> to the sub-shell.
835 A prefix command to conveniently access the global <C-x> commands.
836 For example, `C-c C-x o' invokes the global binding of `C-x o',
837 which is normally `other-window'.
840 File: xemacs.info, Node: Paging in Term, Prev: Term Mode, Up: Shell
842 Paging in the terminal emulator
843 -------------------------------
845 Term mode has a pager feature. When the pager is enabled, term mode
846 will pause at the end of each screenful.
849 Toggles the pager feature: Disables the pager if it is enabled,
850 and vice versa. This works in both line and char modes. If the
851 pager enabled, the mode-line contains the word `page'.
853 If the pager is enabled, and Term receives more than a screenful of
854 output since your last input, Term will enter More break mode. This is
855 indicated by `**MORE**' in the mode-line. Type a `Space' to display
856 the next screenful of output. Type `?' to see your other options. The
857 interface is similar to the Unix `more' program.
860 File: xemacs.info, Node: Narrowing, Next: Hardcopy, Prev: Shell, Up: Top
865 "Narrowing" means focusing in on some portion of the buffer, making
866 the rest temporarily invisible and inaccessible. Cancelling the
867 narrowing and making the entire buffer once again visible is called
868 "widening". The amount of narrowing in effect in a buffer at any time
869 is called the buffer's "restriction".
872 Narrow down to between point and mark (`narrow-to-region').
875 Widen to make the entire buffer visible again (`widen').
877 Narrowing sometimes makes it easier to concentrate on a single
878 subroutine or paragraph by eliminating clutter. It can also be used to
879 restrict the range of operation of a replace command or repeating
880 keyboard macro. The word `Narrow' appears in the mode line whenever
881 narrowing is in effect. When you have narrowed to a part of the
882 buffer, that part appears to be all there is. You can't see the rest,
883 can't move into it (motion commands won't go outside the visible part),
884 and can't change it in any way. However, the invisible text is not
885 gone; if you save the file, it will be saved.
887 The primary narrowing command is `C-x n n' (`narrow-to-region'). It
888 sets the current buffer's restrictions so that the text in the current
889 region remains visible but all text before the region or after the
890 region is invisible. Point and mark do not change.
892 Because narrowing can easily confuse users who do not understand it,
893 `narrow-to-region' is normally a disabled command. Attempting to use
894 this command asks for confirmation and gives you the option of enabling
895 it; once you enable the command, confirmation will no longer be
896 required. *Note Disabling::.
898 To undo narrowing, use `C-x n w' (`widen'). This makes all text in
899 the buffer accessible again.
901 Use the `C-x =' command to get information on what part of the
902 buffer you narrowed down. *Note Position Info::.
905 File: xemacs.info, Node: Hardcopy, Next: Recursive Edit, Prev: Narrowing, Up: Top
910 The XEmacs commands for making hardcopy derive their names from the
911 Unix commands `print' and `lpr'.
914 Print hardcopy of current buffer using Unix command `print'
915 (`lpr -p'). This command adds page headings containing the file
916 name and page number.
919 Print hardcopy of current buffer using Unix command `lpr'. This
920 command does not add page headings.
923 Like `print-buffer', but prints only the current region.
926 Like `lpr-buffer', but prints only the current region.
928 All the hardcopy commands pass extra switches to the `lpr' program
929 based on the value of the variable `lpr-switches'. Its value should be
930 a list of strings, each string a switch starting with `-'. For
931 example, the value could be `("-Pfoo")' to print on printer `foo'.
934 File: xemacs.info, Node: Recursive Edit, Next: Dissociated Press, Prev: Hardcopy, Up: Top
936 Recursive Editing Levels
937 ========================
939 A "recursive edit" is a situation in which you are using XEmacs
940 commands to perform arbitrary editing while in the middle of another
941 XEmacs command. For example, when you type `C-r' inside a
942 `query-replace', you enter a recursive edit in which you can change the
943 current buffer. When you exit from the recursive edit, you go back to
946 "Exiting" a recursive edit means returning to the unfinished
947 command, which continues execution. For example, exiting the recursive
948 edit requested by `C-r' in `query-replace' causes query replacing to
949 resume. Exiting is done with `C-M-c' (`exit-recursive-edit').
951 You can also "abort" a recursive edit. This is like exiting, but
952 also quits the unfinished command immediately. Use the command `C-]'
953 (`abort-recursive-edit') for this. *Note Quitting::.
955 The mode line shows you when you are in a recursive edit by
956 displaying square brackets around the parentheses that always surround
957 the major and minor mode names. Every window's mode line shows the
958 square brackets, since XEmacs as a whole, rather than any particular
959 buffer, is in a recursive edit.
961 It is possible to be in recursive edits within recursive edits. For
962 example, after typing `C-r' in a `query-replace', you might type a
963 command that entered the debugger. In such a case, two or more sets of
964 square brackets appear in the mode line(s). Exiting the inner
965 recursive edit (here with the debugger `c' command) resumes the
966 query-replace command where it called the debugger. After the end of
967 the query-replace command, you would be able to exit the first
968 recursive edit. Aborting exits only one level of recursive edit; it
969 returns to the command level of the previous recursive edit. You can
970 then abort that one as well.
972 The command `M-x top-level' aborts all levels of recursive edits,
973 returning immediately to the top level command reader.
975 The text you edit inside the recursive edit need not be the same text
976 that you were editing at top level. If the command that invokes the
977 recursive edit selects a different buffer first, that is the buffer you
978 will edit recursively. You can switch buffers within the recursive edit
979 in the normal manner (as long as the buffer-switching keys have not been
980 rebound). While you could theoretically do the rest of your editing
981 inside the recursive edit, including visiting files, this could have
982 surprising effects (such as stack overflow) from time to time. It is
983 best if you always exit or abort a recursive edit when you no longer
986 In general, XEmacs tries to avoid using recursive edits. It is
987 usually preferable to allow users to switch among the possible editing
988 modes in any order they like. With recursive edits, the only way to get
989 to another state is to go "back" to the state that the recursive edit
993 File: xemacs.info, Node: Dissociated Press, Next: CONX, Prev: Recursive Edit, Up: Top
998 `M-x dissociated-press' is a command for scrambling a file of text
999 either word by word or character by character. Starting from a buffer
1000 of straight English, it produces extremely amusing output. The input
1001 comes from the current XEmacs buffer. Dissociated Press writes its
1002 output in a buffer named `*Dissociation*', and redisplays that buffer
1003 after every couple of lines (approximately) to facilitate reading it.
1005 `dissociated-press' asks every so often whether to continue
1006 operating. Answer `n' to stop it. You can also stop at any time by
1007 typing `C-g'. The dissociation output remains in the `*Dissociation*'
1008 buffer for you to copy elsewhere if you wish.
1010 Dissociated Press operates by jumping at random from one point in the
1011 buffer to another. In order to produce plausible output rather than
1012 gibberish, it insists on a certain amount of overlap between the end of
1013 one run of consecutive words or characters and the start of the next.
1014 That is, if it has just printed out `president' and then decides to
1015 jump to a different point in the file, it might spot the `ent' in
1016 `pentagon' and continue from there, producing `presidentagon'. Long
1017 sample texts produce the best results.
1019 A positive argument to `M-x dissociated-press' tells it to operate
1020 character by character, and specifies the number of overlap characters.
1021 A negative argument tells it to operate word by word and specifies the
1022 number of overlap words. In this mode, whole words are treated as the
1023 elements to be permuted, rather than characters. No argument is
1024 equivalent to an argument of two. For your againformation, the output
1025 goes only into the buffer `*Dissociation*'. The buffer you start with
1028 Dissociated Press produces nearly the same results as a Markov chain
1029 based on a frequency table constructed from the sample text. It is,
1030 however, an independent, ignoriginal invention. Dissociated Press
1031 techniquitously copies several consecutive characters from the sample
1032 between random choices, whereas a Markov chain would choose randomly for
1033 each word or character. This makes for more plausible sounding results
1036 It is a mustatement that too much use of Dissociated Press can be a
1037 developediment to your real work. Sometimes to the point of outragedy.
1038 And keep dissociwords out of your documentation, if you want it to be
1039 well userenced and properbose. Have fun. Your buggestions are welcome.
1042 File: xemacs.info, Node: CONX, Next: Amusements, Prev: Dissociated Press, Up: Top
1047 Besides producing a file of scrambled text with Dissociated Press,
1048 you can generate random sentences by using CONX.
1051 Generate random sentences in the `*conx*' buffer.
1054 Absorb the text in the current buffer into the `conx' database.
1057 Forget the current word-frequency tree.
1060 Load a `conx' database that has been previously saved with `M-x
1064 Absorb the text in the current buffer into the `conx' database.
1067 Save the current `conx' database to a file for future retrieval.
1069 Copy text from a buffer using `M-x conx-buffer' or `M-x conx-region'
1070 and then type `M-x conx'. Output is continuously generated until you
1071 type <^G>. You can save the `conx' database to a file with `M-x
1072 conx-save', which you can retrieve with `M-x conx-load'. To clear the
1073 database, use `M-x conx-init'.
1076 File: xemacs.info, Node: Amusements, Next: Emulation, Prev: CONX, Up: Top
1081 If you are a little bit bored, you can try `M-x hanoi'. If you are
1082 considerably bored, give it a numeric argument. If you are very, very
1083 bored, try an argument of 9. Sit back and watch.
1085 When you are frustrated, try the famous Eliza program. Just do `M-x
1086 doctor'. End each input by typing `RET' twice.
1088 When you are feeling strange, type `M-x yow'.
1091 File: xemacs.info, Node: Emulation, Next: Customization, Prev: Amusements, Up: Top
1096 XEmacs can be programmed to emulate (more or less) most other
1097 editors. Standard facilities can emulate these:
1099 Viper (a vi emulator)
1100 In XEmacs, Viper is the preferred emulation of vi within XEmacs.
1101 Viper is designed to allow you to take advantage of the best
1102 features of XEmacs while still doing your basic editing in a
1103 familiar, vi-like fashion. Viper provides various different
1104 levels of vi emulation, from a quite complete emulation that
1105 allows almost no access to native XEmacs commands, to an "expert"
1106 mode that combines the most useful vi commands with the most
1107 useful XEmacs commands.
1109 To start Viper, put the command
1113 in your `.emacs' file.
1115 Viper comes with a separate manual that is provided standard with
1116 the XEmacs distribution.
1118 EDT (DEC VMS editor)
1119 Turn on EDT emulation with `M-x edt-emulation-on'. `M-x
1120 edt-emulation-off' restores normal Emacs command bindings.
1122 Most of the EDT emulation commands are keypad keys, and most
1123 standard Emacs key bindings are still available. The EDT
1124 emulation rebindings are done in the global keymap, so there is no
1125 problem switching buffers or major modes while in EDT emulation.
1128 Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
1129 set-gosmacs-bindings'. This redefines many keys, mostly on the
1130 `C-x' and `ESC' prefixes, to work as they do in Gosmacs. `M-x
1131 set-gnu-bindings' returns to normal XEmacs by rebinding the same
1132 keys to the definitions they had at the time `M-x
1133 set-gosmacs-bindings' was done.
1135 It is also possible to run Mocklisp code written for Gosling Emacs.
1139 File: xemacs.info, Node: Customization, Next: Quitting, Prev: Emulation, Up: Top
1144 This chapter talks about various topics relevant to adapting the
1145 behavior of Emacs in minor ways.
1147 All kinds of customization affect only the particular Emacs job that
1148 you do them in. They are completely lost when you kill the Emacs job,
1149 and have no effect on other Emacs jobs you may run at the same time or
1150 later. The only way an Emacs job can affect anything outside of it is
1151 by writing a file; in particular, the only way to make a customization
1152 `permanent' is to put something in your `.emacs' file or other
1153 appropriate file to do the customization in each session. *Note Init
1158 * Minor Modes:: Each minor mode is one feature you can turn on
1159 independently of any others.
1160 * Variables:: Many Emacs commands examine Emacs variables
1161 to decide what to do; by setting variables,
1162 you can control their functioning.
1163 * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
1164 to be replayed with a single command.
1165 * Key Bindings:: The keymaps say what command each key runs.
1166 By changing them, you can "redefine keys".
1167 * Syntax:: The syntax table controls how words and expressions
1169 * Init File:: How to write common customizations in the `.emacs'
1171 * Audible Bell:: Changing how Emacs sounds the bell.
1172 * Faces:: Changing the fonts and colors of a region of text.
1173 * X Resources:: X resources controlling various aspects of the