1 This is ../info/xemacs.info, produced by makeinfo version 4.0b 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 init file:
240 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
244 For each day, this sorts diary entries that begin with a recognizable
245 time of day according to their times. Diary entries without times come
246 first within each day.
249 File: xemacs.info, Node: Included Diary Files, Next: Sexp Diary Entries, Prev: Fancy Diary Display, Up: Calendar Customization
254 Fancy diary display also has the ability to process included diary
255 files. This permits a group of people to share a diary file for events
256 that apply to all of them. Lines in the diary file of this form:
260 includes the diary entries from the file FILENAME in the fancy diary
261 buffer. The include mechanism is recursive, so that included files can
262 include other files, and so on; you must be careful not to have a cycle
263 of inclusions, of course. Here is how to enable the include facility:
265 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
266 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
268 The include mechanism works only with the fancy diary display,
269 because ordinary diary display shows the entries directly from your
273 File: xemacs.info, Node: Sexp Diary Entries, Next: Appt Customizing, Prev: Included Diary Files, Up: Calendar Customization
275 Sexp Entries and the Fancy Diary Display
276 ........................................
278 Sexp diary entries allow you to do more than just have complicated
279 conditions under which a diary entry applies. If you use the fancy
280 diary display, sexp entries can generate the text of the entry depending
281 on the date itself. For example, an anniversary diary entry can insert
282 the number of years since the anniversary date into the text of the
283 diary entry. Thus the `%d' in this dairy entry:
285 %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
287 gets replaced by the age, so on October 31, 1990 the entry appears in
288 the fancy diary buffer like this:
290 Arthur's birthday (42 years old)
292 If the diary file instead contains this entry:
294 %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
296 the entry in the fancy diary buffer for October 31, 1990 appears like
299 Arthur's 42nd birthday
301 Similarly, cyclic diary entries can interpolate the number of
302 repetitions that have occurred:
304 %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
308 Renew medication (5th time)
310 in the fancy diary display on September 8, 1990.
312 The generality of sexp diary entries lets you specify any diary entry
313 that you can describe algorithmically. A sexp diary entry contains an
314 expression that computes whether the entry applies to any given date.
315 If its value is non-`nil', the entry applies to that date; otherwise,
316 it does not. The expression can use the variable `date' to find the
317 date being considered; its value is a list (MONTH DAY YEAR) that refers
318 to the Gregorian calendar.
320 Suppose you get paid on the 21st of the month if it is a weekday, and
321 on the Friday before if the 21st is on a weekend. Here is how to write
322 a sexp diary entry that matches those dates:
324 &%%(let ((dayname (calendar-day-of-week date))
325 (day (car (cdr date))))
326 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
327 (and (memq day '(19 20)) (= dayname 5)))
328 ) Pay check deposited
330 applies to just those dates. This example illustrates how the sexp can
331 depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
332 that gives the Gregorian date for which the diary entries are being
333 found. If the value of the expression is `t', the entry applies to
334 that date. If the expression evaluates to `nil', the entry does _not_
337 The following sexp diary entries take advantage of the ability (in
338 the fancy diary display) to concoct diary entries whose text varies
341 `%%(diary-sunrise-sunset)'
342 Make a diary entry for the local times of today's sunrise and
345 `%%(diary-phases-of-moon)'
346 Make a diary entry for the phases (quarters) of the moon.
348 `%%(diary-day-of-year)'
349 Make a diary entry with today's day number in the current year and
350 the number of days remaining in the current year.
353 Make a diary entry with today's equivalent ISO commercial date.
355 `%%(diary-julian-date)'
356 Make a diary entry with today's equivalent date on the Julian
359 `%%(diary-astro-day-number)'
360 Make a diary entry with today's equivalent astronomical (Julian)
363 `%%(diary-hebrew-date)'
364 Make a diary entry with today's equivalent date on the Hebrew
367 `%%(diary-islamic-date)'
368 Make a diary entry with today's equivalent date on the Islamic
371 `%%(diary-french-date)'
372 Make a diary entry with today's equivalent date on the French
373 Revolutionary calendar.
375 `%%(diary-mayan-date)'
376 Make a diary entry with today's equivalent date on the Mayan
379 Thus including the diary entry
381 &%%(diary-hebrew-date)
383 causes every day's diary display to contain the equivalent date on the
384 Hebrew calendar, if you are using the fancy diary display. (With simple
385 diary display, the line `&%%(diary-hebrew-date)' appears in the diary
386 for any date, but does nothing particularly useful.)
388 These functions can be used to construct sexp diary entries based on
389 the Hebrew calendar in certain standard ways:
391 `%%(diary-rosh-hodesh)'
392 Make a diary entry that tells the occurrence and ritual
393 announcement of each new Hebrew month.
396 Make a Saturday diary entry that tells the weekly synagogue
399 `%%(diary-sabbath-candles)'
400 Make a Friday diary entry that tells the _local time_ of Sabbath
404 Make a diary entry that gives the omer count, when appropriate.
406 `%%(diary-yahrzeit MONTH DAY YEAR) NAME'
407 Make a diary entry marking the anniversary of a date of death.
408 The date is the _Gregorian_ (civil) date of death. The diary
409 entry appears on the proper Hebrew calendar anniversary and on the
410 day before. (In the European style, the order of the parameters
411 is changed to DAY, MONTH, YEAR.)
414 File: xemacs.info, Node: Appt Customizing, Prev: Sexp Diary Entries, Up: Calendar Customization
416 Customizing Appointment Reminders
417 .................................
419 You can specify exactly how Emacs reminds you of an appointment, and
420 how far in advance it begins doing so, by setting these variables:
422 `appt-message-warning-time'
423 The time in minutes before an appointment that the reminder
424 begins. The default is 10 minutes.
427 If this is `t' (the default), Emacs rings the terminal bell for
428 appointment reminders.
431 If this is `t' (the default), Emacs displays the appointment
432 message in echo area.
434 `appt-display-mode-line'
435 If this is `t' (the default), Emacs displays the number of minutes
436 to the appointment on the mode line.
439 If this is `t' (the default), Emacs displays the appointment
440 message in another window.
442 `appt-display-duration'
443 The number of seconds an appointment message is displayed. The
444 default is 5 seconds.
447 File: xemacs.info, Node: Sorting, Next: Shell, Prev: Calendar/Diary, Up: Top
452 XEmacs provides several commands for sorting text in a buffer. All
453 operate on the contents of the region (the text between point and the
454 mark). They divide the text of the region into many "sort records",
455 identify a "sort key" for each record, and then reorder the records
456 using the order determined by the sort keys. The records are ordered so
457 that their keys are in alphabetical order, or, for numerical sorting, in
458 numerical order. In alphabetical sorting, all upper-case letters `A'
459 through `Z' come before lower-case `a', in accordance with the ASCII
462 The sort commands differ in how they divide the text into sort
463 records and in which part of each record they use as the sort key.
464 Most of the commands make each line a separate sort record, but some
465 commands use paragraphs or pages as sort records. Most of the sort
466 commands use each entire sort record as its own sort key, but some use
467 only a portion of the record as the sort key.
470 Divide the region into lines and sort by comparing the entire text
471 of a line. A prefix argument means sort in descending order.
473 `M-x sort-paragraphs'
474 Divide the region into paragraphs and sort by comparing the entire
475 text of a paragraph (except for leading blank lines). A prefix
476 argument means sort in descending order.
479 Divide the region into pages and sort by comparing the entire text
480 of a page (except for leading blank lines). A prefix argument
481 means sort in descending order.
484 Divide the region into lines and sort by comparing the contents of
485 one field in each line. Fields are defined as separated by
486 whitespace, so the first run of consecutive non-whitespace
487 characters in a line constitutes field 1, the second such run
488 constitutes field 2, etc.
490 You specify which field to sort by with a numeric argument: 1 to
491 sort by field 1, etc. A negative argument means sort in descending
492 order. Thus, minus 2 means sort by field 2 in reverse-alphabetical
495 `M-x sort-numeric-fields'
496 Like `M-x sort-fields', except the specified field is converted to
497 a number for each line and the numbers are compared. `10' comes
498 before `2' when considered as text, but after it when considered
502 Like `M-x sort-fields', except that the text within each line used
503 for comparison comes from a fixed range of columns. An explanation
506 For example, if the buffer contains:
508 On systems where clash detection (locking of files being edited) is
509 implemented, XEmacs also checks the first time you modify a buffer
510 whether the file has changed on disk since it was last visited or
511 saved. If it has, you are asked to confirm that you want to change
514 then if you apply `M-x sort-lines' to the entire buffer you get:
516 On systems where clash detection (locking of files being edited) is
517 implemented, XEmacs also checks the first time you modify a buffer
518 saved. If it has, you are asked to confirm that you want to change
520 whether the file has changed on disk since it was last visited or
522 where the upper case `O' comes before all lower case letters. If you
523 apply instead `C-u 2 M-x sort-fields' you get:
525 saved. If it has, you are asked to confirm that you want to change
526 implemented, XEmacs also checks the first time you modify a buffer
528 On systems where clash detection (locking of files being edited) is
529 whether the file has changed on disk since it was last visited or
531 where the sort keys were `If', `XEmacs', `buffer', `systems', and `the'.
533 `M-x sort-columns' requires more explanation. You specify the
534 columns by putting point at one of the columns and the mark at the other
535 column. Because this means you cannot put point or the mark at the
536 beginning of the first line to sort, this command uses an unusual
537 definition of `region': all of the line point is in is considered part
538 of the region, and so is all of the line the mark is in.
540 For example, to sort a table by information found in columns 10 to
541 15, you could put the mark on column 10 in the first line of the table,
542 and point on column 15 in the last line of the table, and then use this
543 command. Or you could put the mark on column 15 in the first line and
544 point on column 10 in the last line.
546 This can be thought of as sorting the rectangle specified by point
547 and the mark, except that the text on each line to the left or right of
548 the rectangle moves along with the text inside the rectangle. *Note
552 File: xemacs.info, Node: Shell, Next: Narrowing, Prev: Sorting, Up: Top
554 Running Shell Commands from XEmacs
555 ==================================
557 XEmacs has commands for passing single command lines to inferior
558 shell processes; it can also run a shell interactively with input and
559 output to an XEmacs buffer `*shell*'.
562 Run a specified shell command line and display the output
566 Run a specified shell command line with region contents as input;
567 optionally replace the region with the output
568 (`shell-command-on-region').
571 Run a subshell with input and output through an XEmacs buffer.
572 You can then give commands interactively.
575 Run a subshell with input and output through an XEmacs buffer.
576 You can then give commands interactively. Full terminal emulation
581 * Single Shell:: How to run one shell command and return.
582 * Interactive Shell:: Permanent shell taking input via XEmacs.
583 * Shell Mode:: Special XEmacs commands used with permanent shell.
584 * Terminal emulator:: An XEmacs window as a terminal emulator.
585 * Term Mode:: Special XEmacs commands used in Term mode.
586 * Paging in Term:: Paging in the terminal emulator.
589 File: xemacs.info, Node: Single Shell, Next: Interactive Shell, Prev: Shell, Up: Shell
591 Single Shell Commands
592 ---------------------
594 `M-!' (`shell-command') reads a line of text using the minibuffer
595 and creates an inferior shell to execute the line as a command.
596 Standard input from the command comes from the null device. If the
597 shell command produces any output, the output goes to an XEmacs buffer
598 named `*Shell Command Output*', which is displayed in another window
599 but not selected. A numeric argument, as in `M-1 M-!', directs this
600 command to insert any output into the current buffer. In that case,
601 point is left before the output and the mark is set after the output.
603 `M-|' (`shell-command-on-region') is like `M-!' but passes the
604 contents of the region as input to the shell command, instead of no
605 input. If a numeric argument is used to direct output to the current
606 buffer, then the old region is deleted first and the output replaces it
607 as the contents of the region.
609 Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
610 use. This variable is initialized based on your `SHELL' environment
611 variable when you start XEmacs. If the file name does not specify a
612 directory, the directories in the list `exec-path' are searched; this
613 list is initialized based on the `PATH' environment variable when you
614 start XEmacs. You can override either or both of these default
615 initializations in your init file. *Note Init File::.
617 When you use `M-!' and `M-|', XEmacs has to wait until the shell
618 command completes. You can quit with `C-g'; that terminates the shell
622 File: xemacs.info, Node: Interactive Shell, Next: Shell Mode, Prev: Single Shell, Up: Shell
624 Interactive Inferior Shell
625 --------------------------
627 To run a subshell interactively with its typescript in an XEmacs
628 buffer, use `M-x shell'. This creates (or reuses) a buffer named
629 `*shell*' and runs a subshell with input coming from and output going
630 to that buffer. That is to say, any "terminal output" from the subshell
631 will go into the buffer, advancing point, and any "terminal input" for
632 the subshell comes from text in the buffer. To give input to the
633 subshell, go to the end of the buffer and type the input, terminated by
636 XEmacs does not wait for the subshell to do anything. You can switch
637 windows or buffers and edit them while the shell is waiting, or while
638 it is running a command. Output from the subshell waits until XEmacs
639 has time to process it; this happens whenever XEmacs is waiting for
640 keyboard input or for time to elapse.
642 To get multiple subshells, change the name of buffer `*shell*' to
643 something different by using `M-x rename-buffer'. The next use of `M-x
644 shell' creates a new buffer `*shell*' with its own subshell. By
645 renaming this buffer as well you can create a third one, and so on.
646 All the subshells run independently and in parallel.
648 The file name used to load the subshell is the value of the variable
649 `explicit-shell-file-name', if that is non-`nil'. Otherwise, the
650 environment variable `ESHELL' is used, or the environment variable
651 `SHELL' if there is no `ESHELL'. If the file name specified is
652 relative, the directories in the list `exec-path' are searched (*note
653 Single Shell Commands: Single Shell.).
655 As soon as the subshell is started, it is sent as input the contents
656 of the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME
657 is the name of the file that the shell was loaded from. For example,
658 if you use `csh', the file sent to it is `~/.emacs_csh'.
660 `cd', `pushd', and `popd' commands given to the inferior shell are
661 watched by XEmacs so it can keep the `*shell*' buffer's default
662 directory the same as the shell's working directory. These commands
663 are recognized syntactically by examining lines of input that are sent.
664 If you use aliases for these commands, you can tell XEmacs to
665 recognize them also. For example, if the value of the variable
666 `shell-pushd-regexp' matches the beginning of a shell command line,
667 that line is regarded as a `pushd' command. Change this variable when
668 you add aliases for `pushd'. Likewise, `shell-popd-regexp' and
669 `shell-cd-regexp' are used to recognize commands with the meaning of
672 `M-x shell-resync-dirs' queries the shell and resynchronizes XEmacs'
673 idea of what the current directory stack is. `M-x
674 shell-dirtrack-toggle' turns directory tracking on and off.
676 XEmacs keeps a history of the most recent commands you have typed in
677 the `*shell*' buffer. If you are at the beginning of a shell command
678 line and type <M-p>, the previous shell input is inserted into the
679 buffer before point. Immediately typing <M-p> again deletes that input
680 and inserts the one before it. By repeating <M-p> you can move
681 backward through your commands until you find one you want to repeat.
682 You may then edit the command before typing <RET> if you wish. <M-n>
683 moves forward through the command history, in case you moved backward
684 past the one you wanted while using <M-p>. If you type the first few
685 characters of a previous command and then type <M-p>, the most recent
686 shell input starting with those characters is inserted. This can be
687 very convenient when you are repeating a sequence of shell commands.
688 The variable `input-ring-size' controls how many commands are saved in
689 your input history. The default is 30.
692 File: xemacs.info, Node: Shell Mode, Next: Terminal emulator, Prev: Interactive Shell, Up: Shell
697 The shell buffer uses Shell mode, which defines several special keys
698 attached to the `C-c' prefix. They are chosen to resemble the usual
699 editing and job control characters present in shells that are not under
700 XEmacs, except that you must type `C-c' first. Here is a list of the
701 special key bindings of Shell mode:
704 At end of buffer send line as input; otherwise, copy current line
705 to end of buffer and send it (`send-shell-input'). When a line is
706 copied, any text at the beginning of the line that matches the
707 variable `shell-prompt-pattern' is left out; this variable's value
708 should be a regexp string that matches the prompts that you use in
712 Send end-of-file as input, probably causing the shell or its
713 current subjob to finish (`shell-send-eof').
716 If point is not at the end of the buffer, delete the next
717 character just like most other modes. If point is at the end of
718 the buffer, send end-of-file as input, instead of generating an
719 error as in other modes (`comint-delchar-or-maybe-eof').
722 Kill all text that has yet to be sent as input
723 (`kill-shell-input').
726 Kill a word before point (`backward-kill-word').
729 Interrupt the shell or its current subjob if any
730 (`interrupt-shell-subjob').
733 Stop the shell or its current subjob if any (`stop-shell-subjob').
736 Send quit signal to the shell or its current subjob if any
737 (`quit-shell-subjob').
740 Delete last batch of output from shell (`kill-output-from-shell').
743 Scroll top of last batch of output to top of window
744 (`show-output-from-shell').
747 Copy the previous bunch of shell input and insert it into the
748 buffer before point (`copy-last-shell-input'). No final newline
749 is inserted, and the input copied is not resubmitted until you type
753 Move backward through the input history. Search for a matching
754 command if you have typed the beginning of a command
755 (`comint-previous-input').
758 Move forward through the input history. Useful when you are using
759 <M-p> quickly and go past the desired command
760 (`comint-next-input').
763 Complete the file name preceding point (`comint-dynamic-complete').
766 File: xemacs.info, Node: Terminal emulator, Next: Term Mode, Prev: Shell Mode, Up: Shell
768 Interactive Inferior Shell with Terminal Emulator
769 -------------------------------------------------
771 To run a subshell in a terminal emulator, putting its typescript in
772 an XEmacs buffer, use `M-x term'. This creates (or reuses) a buffer
773 named `*term*' and runs a subshell with input coming from your keyboard
774 and output going to that buffer.
776 All the normal keys that you type are sent without any interpretation
777 by XEmacs directly to the subshell, as "terminal input." Any "echo" of
778 your input is the responsibility of the subshell. (The exception is
779 the terminal escape character, which by default is `C-c'. *note Term
780 Mode::.) Any "terminal output" from the subshell goes into the buffer,
783 Some programs (such as XEmacs itself) need to control the appearance
784 on the terminal screen in detail. They do this by sending special
785 control codes. The exact control codes needed vary from terminal to
786 terminal, but nowadays most terminals and terminal emulators (including
787 xterm) understand the so-called "ANSI escape sequences" (first
788 popularized by the Digital's VT100 family of terminal). The term mode
789 also understands these escape sequences, and for each control code does
790 the appropriate thing to change the buffer so that the appearance of
791 the window will match what it would be on a real terminal. Thus you
792 can actually run XEmacs inside an XEmacs Term window!
794 XEmacs does not wait for the subshell to do anything. You can switch
795 windows or buffers and edit them while the shell is waiting, or while
796 it is running a command. Output from the subshell waits until XEmacs
797 has time to process it; this happens whenever XEmacs is waiting for
798 keyboard input or for time to elapse.
800 To make multiple terminal emulators, rename the buffer `*term*' to
801 something different using `M-x rename-uniquely', just as with Shell
804 The file name used to load the subshell is determined the same way
807 Unlike Shell mode, Term mode does not track the current directory by
808 examining your input. Instead, if you use a programmable shell, you
809 can have it tell Term what the current directory is. This is done
810 automatically by bash for version 1.15 and later.
813 File: xemacs.info, Node: Term Mode, Next: Paging in Term, Prev: Terminal emulator, Up: Shell
818 Term uses Term mode, which has two input modes: In line mode, Term
819 basically acts like Shell mode. *Note Shell Mode::. In Char mode,
820 each character is sent directly to the inferior subshell, except for
821 the Term escape character, normally `C-c'.
823 To switch between line and char mode, use these commands:
824 findex term-char-mode
827 Switch to line mode. Do nothing if already in line mode.
830 Switch to char mode. Do nothing if already in char mode.
832 The following commands are only available in Char mode:
834 Send a literal <C-c> to the sub-shell.
837 A prefix command to conveniently access the global <C-x> commands.
838 For example, `C-c C-x o' invokes the global binding of `C-x o',
839 which is normally `other-window'.
842 File: xemacs.info, Node: Paging in Term, Prev: Term Mode, Up: Shell
844 Paging in the terminal emulator
845 -------------------------------
847 Term mode has a pager feature. When the pager is enabled, term mode
848 will pause at the end of each screenful.
851 Toggles the pager feature: Disables the pager if it is enabled,
852 and vice versa. This works in both line and char modes. If the
853 pager enabled, the mode-line contains the word `page'.
855 If the pager is enabled, and Term receives more than a screenful of
856 output since your last input, Term will enter More break mode. This is
857 indicated by `**MORE**' in the mode-line. Type a `Space' to display
858 the next screenful of output. Type `?' to see your other options. The
859 interface is similar to the Unix `more' program.
862 File: xemacs.info, Node: Narrowing, Next: Hardcopy, Prev: Shell, Up: Top
867 "Narrowing" means focusing in on some portion of the buffer, making
868 the rest temporarily invisible and inaccessible. Cancelling the
869 narrowing and making the entire buffer once again visible is called
870 "widening". The amount of narrowing in effect in a buffer at any time
871 is called the buffer's "restriction".
874 Narrow down to between point and mark (`narrow-to-region').
877 Widen to make the entire buffer visible again (`widen').
879 Narrowing sometimes makes it easier to concentrate on a single
880 subroutine or paragraph by eliminating clutter. It can also be used to
881 restrict the range of operation of a replace command or repeating
882 keyboard macro. The word `Narrow' appears in the mode line whenever
883 narrowing is in effect. When you have narrowed to a part of the
884 buffer, that part appears to be all there is. You can't see the rest,
885 can't move into it (motion commands won't go outside the visible part),
886 and can't change it in any way. However, the invisible text is not
887 gone; if you save the file, it will be saved.
889 The primary narrowing command is `C-x n n' (`narrow-to-region'). It
890 sets the current buffer's restrictions so that the text in the current
891 region remains visible but all text before the region or after the
892 region is invisible. Point and mark do not change.
894 Because narrowing can easily confuse users who do not understand it,
895 `narrow-to-region' is normally a disabled command. Attempting to use
896 this command asks for confirmation and gives you the option of enabling
897 it; once you enable the command, confirmation will no longer be
898 required. *Note Disabling::.
900 To undo narrowing, use `C-x n w' (`widen'). This makes all text in
901 the buffer accessible again.
903 Use the `C-x =' command to get information on what part of the
904 buffer you narrowed down. *Note Position Info::.
907 File: xemacs.info, Node: Hardcopy, Next: Recursive Edit, Prev: Narrowing, Up: Top
912 The XEmacs commands for making hardcopy derive their names from the
913 Unix commands `print' and `lpr'.
916 Print hardcopy of current buffer using Unix command `print'
917 (`lpr -p'). This command adds page headings containing the file
918 name and page number.
921 Print hardcopy of current buffer using Unix command `lpr'. This
922 command does not add page headings.
925 Like `print-buffer', but prints only the current region.
928 Like `lpr-buffer', but prints only the current region.
930 All the hardcopy commands pass extra switches to the `lpr' program
931 based on the value of the variable `lpr-switches'. Its value should be
932 a list of strings, each string a switch starting with `-'. For
933 example, the value could be `("-Pfoo")' to print on printer `foo'.
936 File: xemacs.info, Node: Recursive Edit, Next: Dissociated Press, Prev: Hardcopy, Up: Top
938 Recursive Editing Levels
939 ========================
941 A "recursive edit" is a situation in which you are using XEmacs
942 commands to perform arbitrary editing while in the middle of another
943 XEmacs command. For example, when you type `C-r' inside a
944 `query-replace', you enter a recursive edit in which you can change the
945 current buffer. When you exit from the recursive edit, you go back to
948 "Exiting" a recursive edit means returning to the unfinished
949 command, which continues execution. For example, exiting the recursive
950 edit requested by `C-r' in `query-replace' causes query replacing to
951 resume. Exiting is done with `C-M-c' (`exit-recursive-edit').
953 You can also "abort" a recursive edit. This is like exiting, but
954 also quits the unfinished command immediately. Use the command `C-]'
955 (`abort-recursive-edit') for this. *Note Quitting::.
957 The mode line shows you when you are in a recursive edit by
958 displaying square brackets around the parentheses that always surround
959 the major and minor mode names. Every window's mode line shows the
960 square brackets, since XEmacs as a whole, rather than any particular
961 buffer, is in a recursive edit.
963 It is possible to be in recursive edits within recursive edits. For
964 example, after typing `C-r' in a `query-replace', you might type a
965 command that entered the debugger. In such a case, two or more sets of
966 square brackets appear in the mode line(s). Exiting the inner
967 recursive edit (here with the debugger `c' command) resumes the
968 query-replace command where it called the debugger. After the end of
969 the query-replace command, you would be able to exit the first
970 recursive edit. Aborting exits only one level of recursive edit; it
971 returns to the command level of the previous recursive edit. You can
972 then abort that one as well.
974 The command `M-x top-level' aborts all levels of recursive edits,
975 returning immediately to the top level command reader.
977 The text you edit inside the recursive edit need not be the same text
978 that you were editing at top level. If the command that invokes the
979 recursive edit selects a different buffer first, that is the buffer you
980 will edit recursively. You can switch buffers within the recursive edit
981 in the normal manner (as long as the buffer-switching keys have not been
982 rebound). While you could theoretically do the rest of your editing
983 inside the recursive edit, including visiting files, this could have
984 surprising effects (such as stack overflow) from time to time. It is
985 best if you always exit or abort a recursive edit when you no longer
988 In general, XEmacs tries to avoid using recursive edits. It is
989 usually preferable to allow users to switch among the possible editing
990 modes in any order they like. With recursive edits, the only way to get
991 to another state is to go "back" to the state that the recursive edit
995 File: xemacs.info, Node: Dissociated Press, Next: CONX, Prev: Recursive Edit, Up: Top
1000 `M-x dissociated-press' is a command for scrambling a file of text
1001 either word by word or character by character. Starting from a buffer
1002 of straight English, it produces extremely amusing output. The input
1003 comes from the current XEmacs buffer. Dissociated Press writes its
1004 output in a buffer named `*Dissociation*', and redisplays that buffer
1005 after every couple of lines (approximately) to facilitate reading it.
1007 `dissociated-press' asks every so often whether to continue
1008 operating. Answer `n' to stop it. You can also stop at any time by
1009 typing `C-g'. The dissociation output remains in the `*Dissociation*'
1010 buffer for you to copy elsewhere if you wish.
1012 Dissociated Press operates by jumping at random from one point in the
1013 buffer to another. In order to produce plausible output rather than
1014 gibberish, it insists on a certain amount of overlap between the end of
1015 one run of consecutive words or characters and the start of the next.
1016 That is, if it has just printed out `president' and then decides to
1017 jump to a different point in the file, it might spot the `ent' in
1018 `pentagon' and continue from there, producing `presidentagon'. Long
1019 sample texts produce the best results.
1021 A positive argument to `M-x dissociated-press' tells it to operate
1022 character by character, and specifies the number of overlap characters.
1023 A negative argument tells it to operate word by word and specifies the
1024 number of overlap words. In this mode, whole words are treated as the
1025 elements to be permuted, rather than characters. No argument is
1026 equivalent to an argument of two. For your againformation, the output
1027 goes only into the buffer `*Dissociation*'. The buffer you start with
1030 Dissociated Press produces nearly the same results as a Markov chain
1031 based on a frequency table constructed from the sample text. It is,
1032 however, an independent, ignoriginal invention. Dissociated Press
1033 techniquitously copies several consecutive characters from the sample
1034 between random choices, whereas a Markov chain would choose randomly for
1035 each word or character. This makes for more plausible sounding results
1038 It is a mustatement that too much use of Dissociated Press can be a
1039 developediment to your real work. Sometimes to the point of outragedy.
1040 And keep dissociwords out of your documentation, if you want it to be
1041 well userenced and properbose. Have fun. Your buggestions are welcome.
1044 File: xemacs.info, Node: CONX, Next: Amusements, Prev: Dissociated Press, Up: Top
1049 Besides producing a file of scrambled text with Dissociated Press,
1050 you can generate random sentences by using CONX.
1053 Generate random sentences in the `*conx*' buffer.
1056 Absorb the text in the current buffer into the `conx' database.
1059 Forget the current word-frequency tree.
1062 Load a `conx' database that has been previously saved with `M-x
1066 Absorb the text in the current buffer into the `conx' database.
1069 Save the current `conx' database to a file for future retrieval.
1071 Copy text from a buffer using `M-x conx-buffer' or `M-x conx-region'
1072 and then type `M-x conx'. Output is continuously generated until you
1073 type <^G>. You can save the `conx' database to a file with `M-x
1074 conx-save', which you can retrieve with `M-x conx-load'. To clear the
1075 database, use `M-x conx-init'.
1078 File: xemacs.info, Node: Amusements, Next: Emulation, Prev: CONX, Up: Top
1083 If you are a little bit bored, you can try `M-x hanoi'. If you are
1084 considerably bored, give it a numeric argument. If you are very, very
1085 bored, try an argument of 9. Sit back and watch.
1087 When you are frustrated, try the famous Eliza program. Just do `M-x
1088 doctor'. End each input by typing `RET' twice.
1090 When you are feeling strange, type `M-x yow'.
1093 File: xemacs.info, Node: Emulation, Next: Customization, Prev: Amusements, Up: Top
1098 XEmacs can be programmed to emulate (more or less) most other
1099 editors. Standard facilities can emulate these:
1101 Viper (a vi emulator)
1102 In XEmacs, Viper is the preferred emulation of vi within XEmacs.
1103 Viper is designed to allow you to take advantage of the best
1104 features of XEmacs while still doing your basic editing in a
1105 familiar, vi-like fashion. Viper provides various different
1106 levels of vi emulation, from a quite complete emulation that
1107 allows almost no access to native XEmacs commands, to an "expert"
1108 mode that combines the most useful vi commands with the most
1109 useful XEmacs commands.
1111 To start Viper, put the command
1115 in your init file. *Note Init File::.
1117 Viper comes with a separate manual that is provided standard with
1118 the XEmacs distribution.
1120 EDT (DEC VMS editor)
1121 Turn on EDT emulation with `M-x edt-emulation-on'. `M-x
1122 edt-emulation-off' restores normal Emacs command bindings.
1124 Most of the EDT emulation commands are keypad keys, and most
1125 standard Emacs key bindings are still available. The EDT
1126 emulation rebindings are done in the global keymap, so there is no
1127 problem switching buffers or major modes while in EDT emulation.
1130 Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
1131 set-gosmacs-bindings'. This redefines many keys, mostly on the
1132 `C-x' and `ESC' prefixes, to work as they do in Gosmacs. `M-x
1133 set-gnu-bindings' returns to normal XEmacs by rebinding the same
1134 keys to the definitions they had at the time `M-x
1135 set-gosmacs-bindings' was done.
1137 It is also possible to run Mocklisp code written for Gosling Emacs.
1141 File: xemacs.info, Node: Customization, Next: Quitting, Prev: Emulation, Up: Top
1146 This chapter talks about various topics relevant to adapting the
1147 behavior of Emacs in minor ways.
1149 All kinds of customization affect only the particular Emacs job that
1150 you do them in. They are completely lost when you kill the Emacs job,
1151 and have no effect on other Emacs jobs you may run at the same time or
1152 later. The only way an Emacs job can affect anything outside of it is
1153 by writing a file; in particular, the only way to make a customization
1154 `permanent' is to put something in your init file or other appropriate
1155 file to do the customization in each session. *Note Init File::.
1159 * Minor Modes:: Each minor mode is one feature you can turn on
1160 independently of any others.
1161 * Variables:: Many Emacs commands examine Emacs variables
1162 to decide what to do; by setting variables,
1163 you can control their functioning.
1164 * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
1165 to be replayed with a single command.
1166 * Key Bindings:: The keymaps say what command each key runs.
1167 By changing them, you can "redefine keys".
1168 * Syntax:: The syntax table controls how words and expressions
1170 * Init File:: How to write common customizations in the init file.
1171 * Audible Bell:: Changing how Emacs sounds the bell.
1172 * Faces:: Changing the fonts and colors of a region of text.
1173 * Frame Components:: Controlling the presence and positions of the
1174 menubar, toolbars, and gutters.
1175 * X Resources:: X resources controlling various aspects of the