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: Specify Coding, Prev: Recognize Coding, Up: Mule
35 Specifying a Coding System
36 ==========================
38 In cases where XEmacs does not automatically choose the right coding
39 system, you can use these commands to specify one:
41 `C-x <RET> f CODING <RET>'
42 Use coding system CODING for the visited file in the current
45 `C-x <RET> c CODING <RET>'
46 Specify coding system CODING for the immediately following command.
48 `C-x <RET> k CODING <RET>'
49 Use coding system CODING for keyboard input.
51 `C-x <RET> t CODING <RET>'
52 Use coding system CODING for terminal output.
54 `C-x <RET> p CODING <RET>'
55 Use coding system CODING for subprocess input and output in the
58 The command `C-x RET f' (`set-buffer-file-coding-system') specifies
59 the file coding system for the current buffer--in other words, which
60 coding system to use when saving or rereading the visited file. You
61 specify which coding system using the minibuffer. Since this command
62 applies to a file you have already visited, it affects only the way the
65 Another way to specify the coding system for a file is when you visit
66 the file. First use the command `C-x <RET> c'
67 (`universal-coding-system-argument'); this command uses the minibuffer
68 to read a coding system name. After you exit the minibuffer, the
69 specified coding system is used for _the immediately following command_.
71 So if the immediately following command is `C-x C-f', for example,
72 it reads the file using that coding system (and records the coding
73 system for when the file is saved). Or if the immediately following
74 command is `C-x C-w', it writes the file using that coding system.
75 Other file commands affected by a specified coding system include `C-x
76 C-i' and `C-x C-v', as well as the other-window variants of `C-x C-f'.
78 In addition, if you run some file input commands with the precedent
79 `C-u', you can specify coding system to read from minibuffer. So if
80 the immediately following command is `C-x C-f', for example, it reads
81 the file using that coding system (and records the coding system for
82 when the file is saved). Other file commands affected by a specified
83 coding system include `C-x C-i' and `C-x C-v', as well as the
84 other-window variants of `C-x C-f'.
86 The variable `default-buffer-file-coding-system' specifies the
87 choice of coding system to use when you create a new file. It applies
88 when you find a new file, and when you create a buffer and then save it
89 in a file. Selecting a language environment typically sets this
90 variable to a good choice of default coding system for that language
93 The command `C-x <RET> t' (`set-terminal-coding-system') specifies
94 the coding system for terminal output. If you specify a character code
95 for terminal output, all characters output to the terminal are
96 translated into that coding system.
98 This feature is useful for certain character-only terminals built to
99 support specific languages or character sets--for example, European
100 terminals that support one of the ISO Latin character sets.
102 By default, output to the terminal is not translated at all.
104 The command `C-x <RET> k' (`set-keyboard-coding-system') specifies
105 the coding system for keyboard input. Character-code translation of
106 keyboard input is useful for terminals with keys that send non-ASCII
107 graphic characters--for example, some terminals designed for ISO
108 Latin-1 or subsets of it.
110 By default, keyboard input is not translated at all.
112 There is a similarity between using a coding system translation for
113 keyboard input, and using an input method: both define sequences of
114 keyboard input that translate into single characters. However, input
115 methods are designed to be convenient for interactive use by humans, and
116 the sequences that are translated are typically sequences of ASCII
117 printing characters. Coding systems typically translate sequences of
118 non-graphic characters.
120 The command `C-x <RET> p' (`set-buffer-process-coding-system')
121 specifies the coding system for input and output to a subprocess. This
122 command applies to the current buffer; normally, each subprocess has its
123 own buffer, and thus you can use this command to specify translation to
124 and from a particular subprocess by giving the command in the
125 corresponding buffer.
127 By default, process input and output are not translated at all.
129 The variable `file-name-coding-system' specifies a coding system to
130 use for encoding file names. If you set the variable to a coding
131 system name (as a Lisp symbol or a string), XEmacs encodes file names
132 using that coding system for all file operations. This makes it
133 possible to use non-Latin-1 characters in file names--or, at least,
134 those non-Latin-1 characters which the specified coding system can
135 encode. By default, this variable is `nil', which implies that you
136 cannot use non-Latin-1 characters in file names.
139 File: xemacs.info, Node: Major Modes, Next: Indentation, Prev: Mule, Up: Top
144 Emacs has many different "major modes", each of which customizes
145 Emacs for editing text of a particular sort. The major modes are
146 mutually exclusive; at any time, each buffer has one major mode. The
147 mode line normally contains the name of the current major mode in
148 parentheses. *Note Mode Line::.
150 The least specialized major mode is called "Fundamental mode". This
151 mode has no mode-specific redefinitions or variable settings. Each
152 Emacs command behaves in its most general manner, and each option is in
153 its default state. For editing any specific type of text, such as Lisp
154 code or English text, you should switch to the appropriate major mode,
155 such as Lisp mode or Text mode.
157 Selecting a major mode changes the meanings of a few keys to become
158 more specifically adapted to the language being edited. <TAB>, <DEL>,
159 and <LFD> are changed frequently. In addition, commands which handle
160 comments use the mode to determine how to delimit comments. Many major
161 modes redefine the syntactical properties of characters appearing in
162 the buffer. *Note Syntax::.
164 The major modes fall into three major groups. Lisp mode (which has
165 several variants), C mode, and Muddle mode are for specific programming
166 languages. Text mode, Nroff mode, TeX mode, and Outline mode are for
167 editing English text. The remaining major modes are not intended for
168 use on users' files; they are used in buffers created by Emacs for
169 specific purposes and include Dired mode for buffers made by Dired
170 (*note Dired::), Mail mode for buffers made by `C-x m' (*note Sending
171 Mail::), and Shell mode for buffers used for communicating with an
172 inferior shell process (*note Interactive Shell::).
174 Most programming language major modes specify that only blank lines
175 separate paragraphs. This is so that the paragraph commands remain
176 useful. *Note Paragraphs::. They also cause Auto Fill mode to use the
177 definition of <TAB> to indent the new lines it creates. This is
178 because most lines in a program are usually indented. *Note
183 * Choosing Modes:: How major modes are specified or chosen.
186 File: xemacs.info, Node: Choosing Modes, Prev: Major Modes, Up: Major Modes
191 You can select a major mode explicitly for the current buffer, but
192 most of the time Emacs determines which mode to use based on the file
193 name or some text in the file.
195 Use a `M-x' command to explicitly select a new major mode. Add
196 `-mode' to the name of a major mode to get the name of a command to
197 select that mode. For example, to enter Lisp mode, execute `M-x
200 When you visit a file, Emacs usually chooses the right major mode
201 based on the file's name. For example, files whose names end in `.c'
202 are edited in C mode. The variable `auto-mode-alist' controls the
203 correspondence between file names and major mode. Its value is a list
204 in which each element has the form:
206 (REGEXP . MODE-FUNCTION)
208 For example, one element normally found in the list has the form
209 `("\\.c$" . c-mode)'. It is responsible for selecting C mode for files
210 whose names end in `.c'. (Note that `\\' is needed in Lisp syntax to
211 include a `\' in the string, which is needed to suppress the special
212 meaning of `.' in regexps.) The only practical way to change this
213 variable is with Lisp code.
215 You can specify which major mode should be used for editing a certain
216 file by a special sort of text in the first non-blank line of the file.
217 The mode name should appear in this line both preceded and followed by
218 `-*-'. Other text may appear on the line as well. For example,
222 tells Emacs to use Lisp mode. Note how the semicolon is used to make
223 Lisp treat this line as a comment. Such an explicit specification
224 overrides any default mode based on the file name.
226 Another format of mode specification is:
228 -*-Mode: MODENAME;-*-
230 which allows other things besides the major mode name to be specified.
231 However, Emacs does not look for anything except the mode name.
233 The major mode can also be specified in a local variables list.
234 *Note File Variables::.
236 When you visit a file that does not specify a major mode to use, or
237 when you create a new buffer with `C-x b', Emacs uses the major mode
238 specified by the variable `default-major-mode'. Normally this value is
239 the symbol `fundamental-mode', which specifies Fundamental mode. If
240 `default-major-mode' is `nil', the major mode is taken from the
241 previously selected buffer.
244 File: xemacs.info, Node: Indentation, Next: Text, Prev: Major Modes, Up: Top
250 Indent current line "appropriately" in a mode-dependent fashion.
253 Perform <RET> followed by <TAB> (`newline-and-indent').
256 Merge two lines (`delete-indentation'). This would cancel out the
260 Split line at point; text on the line after point becomes a new
261 line indented to the same column that it now starts in
265 Move (forward or back) to the first non-blank character on the
266 current line (`back-to-indentation').
269 Indent several lines to same column (`indent-region').
272 Shift block of lines rigidly right or left (`indent-rigidly').
275 Indent from point to the next prespecified tab stop column
278 `M-x indent-relative'
279 Indent from point to under an indentation point in the previous
282 Most programming languages have some indentation convention. For
283 Lisp code, lines are indented according to their nesting in
284 parentheses. The same general idea is used for C code, though details
287 Use the <TAB> command to indent a line whatever the language. Each
288 major mode defines this command to perform indentation appropriate for
289 the particular language. In Lisp mode, <TAB> aligns a line according
290 to its depth in parentheses. No matter where in the line you are when
291 you type <TAB>, it aligns the line as a whole. In C mode, <TAB>
292 implements a subtle and sophisticated indentation style that knows
293 about many aspects of C syntax.
295 In Text mode, <TAB> runs the command `tab-to-tab-stop', which
296 indents to the next tab stop column. You can set the tab stops with
297 `M-x edit-tab-stops'.
301 * Indentation Commands:: Various commands and techniques for indentation.
302 * Tab Stops:: You can set arbitrary "tab stops" and then
303 indent to the next tab stop when you want to.
304 * Just Spaces:: You can request indentation using just spaces.
307 File: xemacs.info, Node: Indentation Commands, Next: Tab Stops, Prev: Indentation, Up: Indentation
309 Indentation Commands and Techniques
310 ===================================
312 If you just want to insert a tab character in the buffer, you can
315 To move over the indentation on a line, type `Meta-m'
316 (`back-to-indentation'). This command, given anywhere on a line,
317 positions point at the first non-blank character on the line.
319 To insert an indented line before the current line, type `C-a C-o
320 <TAB>'. To make an indented line after the current line, use `C-e
323 `C-M-o' (`split-line') moves the text from point to the end of the
324 line vertically down, so that the current line becomes two lines.
325 `C-M-o' first moves point forward over any spaces and tabs. Then it
326 inserts after point a newline and enough indentation to reach the same
327 column point is on. Point remains before the inserted newline; in this
328 regard, `C-M-o' resembles `C-o'.
330 To join two lines cleanly, use the `Meta-^' (`delete-indentation')
331 command to delete the indentation at the front of the current line, and
332 the line boundary as well. Empty spaces are replaced by a single
333 space, or by no space if at the beginning of a line, before a close
334 parenthesis, or after an open parenthesis. To delete just the
335 indentation of a line, go to the beginning of the line and use `Meta-\'
336 (`delete-horizontal-space'), which deletes all spaces and tabs around
339 There are also commands for changing the indentation of several
340 lines at once. `Control-Meta-\' (`indent-region') gives each line which
341 begins in the region the "usual" indentation by invoking <TAB> at the
342 beginning of the line. A numeric argument specifies the column to
343 indent to. Each line is shifted left or right so that its first
344 non-blank character appears in that column. `C-x <TAB>'
345 (`indent-rigidly') moves all the lines in the region right by its
346 argument (left, for negative arguments). The whole group of lines moves
347 rigidly sideways, which is how the command gets its name.
349 `M-x indent-relative' indents at point based on the previous line
350 (actually, the last non-empty line.) It inserts whitespace at point,
351 moving point, until it is underneath an indentation point in the
352 previous line. An indentation point is the end of a sequence of
353 whitespace or the end of the line. If point is farther right than any
354 indentation point in the previous line, the whitespace before point is
355 deleted and the first indentation point then applicable is used. If no
356 indentation point is applicable even then, `tab-to-tab-stop' is run
359 `indent-relative' is the definition of <TAB> in Indented Text mode.
363 File: xemacs.info, Node: Tab Stops, Next: Just Spaces, Prev: Indentation Commands, Up: Indentation
368 For typing in tables, you can use Text mode's definition of <TAB>,
369 `tab-to-tab-stop'. This command inserts indentation before point,
370 enough to reach the next tab stop column. Even if you are not in Text
371 mode, this function is associated with `M-i' anyway.
373 You can arbitrarily set the tab stops used by `M-i'. They are
374 stored as a list of column-numbers in increasing order in the variable
377 The convenient way to set the tab stops is using `M-x
378 edit-tab-stops', which creates and selects a buffer containing a
379 description of the tab stop settings. You can edit this buffer to
380 specify different tab stops, and then type `C-c C-c' to make those new
381 tab stops take effect. In the tab stop buffer, `C-c C-c' runs the
382 function `edit-tab-stops-note-changes' rather than the default
383 `save-buffer'. `edit-tab-stops' records which buffer was current when
384 you invoked it, and stores the tab stops in that buffer. Normally all
385 buffers share the same tab stops and changing them in one buffer
386 affects all. If you make `tab-stop-list' local in one buffer
387 `edit-tab-stops' in that buffer edits only the local settings.
389 Below is the text representing ordinary tab stops every eight
394 0123456789012345678901234567890123456789012345678
395 To install changes, type C-c C-c
397 The first line contains a colon at each tab stop. The remaining
398 lines help you see where the colons are and tell you what to do.
400 Note that the tab stops that control `tab-to-tab-stop' have nothing
401 to do with displaying tab characters in the buffer. *Note Display
402 Vars::, for more information on that.
405 File: xemacs.info, Node: Just Spaces, Prev: Tab Stops, Up: Indentation
410 Emacs normally uses both tabs and spaces to indent lines. If you
411 prefer, all indentation can be made from spaces only. To request this,
412 set `indent-tabs-mode' to `nil'. This is a per-buffer variable;
413 altering the variable affects only the current buffer, but there is a
414 default value which you can change as well. *Note Locals::.
416 There are also commands to convert tabs to spaces or vice versa,
417 always preserving the columns of all non-blank text. `M-x tabify'
418 scans the region for sequences of spaces, and converts sequences of at
419 least three spaces to tabs if that is possible without changing
420 indentation. `M-x untabify' changes all tabs in the region to
421 corresponding numbers of spaces.
424 File: xemacs.info, Node: Text, Next: Programs, Prev: Indentation, Up: Top
426 Commands for Human Languages
427 ****************************
429 The term "text" has two widespread meanings in our area of the
430 computer field. One is data that is a sequence of characters. In this
431 sense of the word any file that you edit with Emacs is text. The other
432 meaning is more restrictive: a sequence of characters in a human
433 language for humans to read (possibly after processing by a text
434 formatter), as opposed to a program or commands for a program.
436 Human languages have syntactic and stylistic conventions that editor
437 commands should support or use to advantage: conventions involving
438 words, sentences, paragraphs, and capital letters. This chapter
439 describes Emacs commands for all these things. There are also commands
440 for "filling", or rearranging paragraphs into lines of approximately
441 equal length. The commands for moving over and killing words,
442 sentences, and paragraphs, while intended primarily for editing text,
443 are also often useful for editing programs.
445 Emacs has several major modes for editing human language text. If a
446 file contains plain text, use Text mode, which customizes Emacs in
447 small ways for the syntactic conventions of text. For text which
448 contains embedded commands for text formatters, Emacs has other major
449 modes, each for a particular text formatter. Thus, for input to TeX,
450 you can use TeX mode; for input to nroff, Nroff mode.
454 * Text Mode:: The major modes for editing text files.
455 * Nroff Mode:: The major mode for editing input to the formatter nroff.
456 * TeX Mode:: The major modes for editing input to the formatter TeX.
457 * Outline Mode:: The major mode for editing outlines.
458 * Words:: Moving over and killing words.
459 * Sentences:: Moving over and killing sentences.
460 * Paragraphs:: Moving over paragraphs.
461 * Pages:: Moving over pages.
462 * Filling:: Filling or justifying text
463 * Case:: Changing the case of text
466 File: xemacs.info, Node: Text Mode, Next: Words, Prev: Text, Up: Text
471 You should use Text mode--rather than Fundamental or Lisp mode--to
472 edit files of text in a human language. Invoke `M-x text-mode' to
473 enter Text mode. In Text mode, <TAB> runs the function
474 `tab-to-tab-stop', which allows you to use arbitrary tab stops set with
475 `M-x edit-tab-stops' (*note Tab Stops::). Features concerned with
476 comments in programs are turned off unless they are explicitly invoked.
477 The syntax table is changed so that periods are not considered part of a
478 word, while apostrophes, backspaces and underlines are.
480 A similar variant mode is Indented Text mode, intended for editing
481 text in which most lines are indented. This mode defines <TAB> to run
482 `indent-relative' (*note Indentation::), and makes Auto Fill indent the
483 lines it creates. As a result, a line made by Auto Filling, or by
484 <LFD>, is normally indented just like the previous line. Use `M-x
485 indented-text-mode' to select this mode.
487 Entering Text mode or Indented Text mode calls the value of the
488 variable `text-mode-hook' with no arguments, if that value exists and
489 is not `nil'. This value is also called when modes related to Text
490 mode are entered; this includes Nroff mode, TeX mode, Outline mode, and
491 Mail mode. Your hook can look at the value of `major-mode' to see
492 which of these modes is actually being entered.
494 Two modes similar to Text mode are of use for editing text that is to
495 be passed through a text formatter before achieving its final readable
500 * Nroff Mode:: The major mode for editing input to the formatter nroff.
501 * TeX Mode:: The major modes for editing input to the formatter TeX.
504 Another similar mode is used for editing outlines. It allows you
505 to view the text at various levels of detail. You can view either
506 the outline headings alone or both headings and text; you can also
507 hide some of the headings at lower levels from view to make the high
508 level structure more visible.
511 * Outline Mode:: The major mode for editing outlines.
514 File: xemacs.info, Node: Nroff Mode, Next: TeX Mode, Prev: Text Mode, Up: Text Mode
519 Nroff mode is a mode like Text mode but modified to handle nroff
520 commands present in the text. Invoke `M-x nroff-mode' to enter this
521 mode. Nroff mode differs from Text mode in only a few ways. All nroff
522 command lines are considered paragraph separators, so that filling never
523 garbles the nroff commands. Pages are separated by `.bp' commands.
524 Comments start with backslash-doublequote. There are also three special
525 commands that are not available in Text mode:
528 Move to the beginning of the next line that isn't an nroff command
529 (`forward-text-line'). An argument is a repeat count.
532 Like `M-n' but move up (`backward-text-line').
535 Prints in the echo area the number of text lines (lines that are
536 not nroff commands) in the region (`count-text-lines').
538 The other feature of Nroff mode is Electric Nroff newline mode.
539 This is a minor mode that you can turn on or off with `M-x
540 electric-nroff-mode' (*note Minor Modes::). When the mode is on and
541 you use <RET> to end a line containing an nroff command that opens a
542 kind of grouping, Emacs automatically inserts the matching nroff
543 command to close that grouping on the following line. For example, if
544 you are at the beginning of a line and type `.(b <RET>', the matching
545 command `.)b' will be inserted on a new line following point.
547 Entering Nroff mode calls the value of the variable `text-mode-hook'
548 with no arguments, if that value exists and is not `nil'; then it does
549 the same with the variable `nroff-mode-hook'.
552 File: xemacs.info, Node: TeX Mode, Next: Outline Mode, Prev: Nroff Mode, Up: Text Mode
557 TeX is a powerful text formatter written by Donald Knuth; like GNU
558 Emacs, it is free. LaTeX is a simplified input format for TeX,
559 implemented by TeX macros. It is part of TeX.
561 Emacs has a special TeX mode for editing TeX input files. It
562 provides facilities for checking the balance of delimiters and for
563 invoking TeX on all or part of the file.
565 TeX mode has two variants, Plain TeX mode and LaTeX mode, which are
566 two distinct major modes that differ only slightly. These modes are
567 designed for editing the two different input formats. The command `M-x
568 tex-mode' looks at the contents of a buffer to determine whether it
569 appears to be LaTeX input or not; it then selects the appropriate mode.
570 If it can't tell which is right (e.g., the buffer is empty), the
571 variable `tex-default-mode' controls which mode is used.
573 The commands `M-x plain-tex-mode' and `M-x latex-mode' explicitly
574 select one of the variants of TeX mode. Use these commands when `M-x
575 tex-mode' does not guess right.
579 * Editing: TeX Editing. Special commands for editing in TeX mode.
580 * Printing: TeX Print. Commands for printing part of a file with TeX.
582 TeX for Unix systems can be obtained from the University of
583 Washington for a distribution fee.
585 To order a full distribution, send $140.00 for a 1/2 inch 9-track
586 tape, $165.00 for two 4-track 1/4 inch cartridge tapes (foreign sites
587 $150.00, for 1/2 inch, $175.00 for 1/4 inch, to cover the extra
588 postage) payable to the University of Washington to:
591 Northwest Computer Support Group, DW-10
592 University of Washington
593 Seattle, Washington 98195
595 Purchase orders are acceptable, but there is an extra charge of $10.00
596 to pay for processing charges. (The total cost comes to $150 for
597 domestic sites, $175 for foreign sites).
599 The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
600 industry standard 2400 foot half-inch reel. The physical format for
601 the 1/4 inch streamer cartridges uses QIC-11, 8000 bpi, 4-track
602 serpentine recording for the SUN. Also, SystemV tapes can be written
603 in cpio format, blocked 5120 bytes, ASCII headers.
606 File: xemacs.info, Node: TeX Editing, Next: TeX Print, Prev: TeX Mode, Up: TeX Mode
611 Here are the special commands provided in TeX mode for editing the
615 Insert, according to context, either ```' or `"' or `'''
616 (`TeX-insert-quote').
619 Insert a paragraph break (two newlines) and check the previous
620 paragraph for unbalanced braces or dollar signs (`tex-terminate-
623 `M-x validate-tex-buffer'
624 Check each paragraph in the buffer for unbalanced braces or dollar
628 Insert `{}' and position point between them (`tex-insert-braces').
631 Move forward past the next unmatched close brace (`up-list').
634 Close a block for LaTeX (`tex-close-latex-block').
636 In TeX, the character `"' is not normally used; you use ```' to
637 start a quotation and `''' to end one. TeX mode defines the key `"' to
638 insert ```' after whitespace or an open brace, `"' after a backslash,
639 or `''' otherwise. This is done by the command `tex-insert-quote'. If
640 you need the character `"' itself in unusual contexts, use `C-q' to
641 insert it. Also, `"' with a numeric argument always inserts that
642 number of `"' characters.
644 In TeX mode, `$' has a special syntax code which attempts to
645 understand the way TeX math mode delimiters match. When you insert a
646 `$' that is meant to exit math mode, the position of the matching `$'
647 that entered math mode is displayed for a second. This is the same
648 feature that displays the open brace that matches a close brace that is
649 inserted. However, there is no way to tell whether a `$' enters math
650 mode or leaves it; so when you insert a `$' that enters math mode, the
651 previous `$' position is shown as if it were a match, even though they
652 are actually unrelated.
654 If you prefer to keep braces balanced at all times, you can use `C-c
655 {' (`tex-insert-braces') to insert a pair of braces. It leaves point
656 between the two braces so you can insert the text that belongs inside.
657 Afterward, use the command `C-c }' (`up-list') to move forward past the
660 There are two commands for checking the matching of braces. <LFD>
661 (`tex-terminate-paragraph') checks the paragraph before point, and
662 inserts two newlines to start a new paragraph. It prints a message in
663 the echo area if any mismatch is found. `M-x validate-tex-buffer'
664 checks the entire buffer, paragraph by paragraph. When it finds a
665 paragraph that contains a mismatch, it displays point at the beginning
666 of the paragraph for a few seconds and pushes a mark at that spot.
667 Scanning continues until the whole buffer has been checked or until you
668 type another key. The positions of the last several paragraphs with
669 mismatches can be found in the mark ring (*note Mark Ring::).
671 Note that square brackets and parentheses, not just braces, are
672 matched in TeX mode. This is wrong if you want to check TeX syntax.
673 However, parentheses and square brackets are likely to be used in text
674 as matching delimiters and it is useful for the various motion commands
675 and automatic match display to work with them.
677 In LaTeX input, `\begin' and `\end' commands must balance. After
678 you insert a `\begin', use `C-c C-f' (`tex-close-latex-block') to
679 insert automatically a matching `\end' (on a new line following the
680 `\begin'). A blank line is inserted between the two, and point is left
684 File: xemacs.info, Node: TeX Print, Prev: TeX Editing, Up: TeX Mode
686 TeX Printing Commands
687 .....................
689 You can invoke TeX as an inferior of Emacs on either the entire
690 contents of the buffer or just a region at a time. Running TeX in this
691 way on just one chapter is a good way to see what your changes look
692 like without taking the time to format the entire file.
695 Invoke TeX on the current region, plus the buffer's header
699 Invoke TeX on the entire current buffer (`tex-buffer').
702 Recenter the window showing output from the inferior TeX so that
703 the last line can be seen (`tex-recenter-output-buffer').
706 Kill the inferior TeX (`tex-kill-job').
709 Print the output from the last `C-c C-r' or `C-c C-b' command
713 Show the printer queue (`tex-show-print-queue').
715 You can pass the current buffer through an inferior TeX using `C-c
716 C-b' (`tex-buffer'). The formatted output appears in a file in `/tmp';
717 to print it, type `C-c C-p' (`tex-print'). Afterward use `C-c C-q'
718 (`tex-show-print-queue') to view the progress of your output towards
721 The console output from TeX, including any error messages, appears
722 in a buffer called `*TeX-shell*'. If TeX gets an error, you can switch
723 to this buffer and feed it input (this works as in Shell mode; *note
724 Interactive Shell::). Without switching to this buffer, you can scroll
725 it so that its last line is visible by typing `C-c C-l'.
727 Type `C-c C-k' (`tex-kill-job') to kill the TeX process if you see
728 that its output is no longer useful. Using `C-c C-b' or `C-c C-r' also
729 kills any TeX process still running.
731 You can pass an arbitrary region through an inferior TeX by typing
732 `C-c C-r' (`tex-region'). This is tricky, however, because most files
733 of TeX input contain commands at the beginning to set parameters and
734 define macros. Without them, no later part of the file will format
735 correctly. To solve this problem, `C-c C-r' allows you to designate a
736 part of the file as containing essential commands; it is included
737 before the specified region as part of the input to TeX. The
738 designated part of the file is called the "header".
740 To indicate the bounds of the header in Plain TeX mode, insert two
741 special strings in the file: `%**start of header' before the header,
742 and `%**end of header' after it. Each string must appear entirely on
743 one line, but there may be other text on the line before or after. The
744 lines containing the two strings are included in the header. If
745 `%**start of header' does not appear within the first 100 lines of the
746 buffer, `C-c C-r' assumes there is no header.
748 In LaTeX mode, the header begins with `\documentstyle' and ends with
749 `\begin{document}'. These are commands that LaTeX requires you to use,
750 so you don't need to do anything special to identify the header.
752 When you enter either kind of TeX mode, Emacs calls with no
753 arguments the value of the variable `text-mode-hook', if that value
754 exists and is not `nil'. Emacs then calls the variable `TeX-mode-hook'
755 and either `plain-TeX-mode-hook' or `LaTeX-mode-hook' under the same
759 File: xemacs.info, Node: Outline Mode, Prev: TeX Mode, Up: Text Mode
764 Outline mode is a major mode similar to Text mode but intended for
765 editing outlines. It allows you to make parts of the text temporarily
766 invisible so that you can see just the overall structure of the
767 outline. Type `M-x outline-mode' to turn on Outline mode in the
770 When you enter Outline mode, Emacs calls with no arguments the value
771 of the variable `text-mode-hook', if that value exists and is not
772 `nil'; then it does the same with the variable `outline-mode-hook'.
774 When a line is invisible in outline mode, it does not appear on the
775 screen. The screen appears exactly as if the invisible line were
776 deleted, except that an ellipsis (three periods in a row) appears at
777 the end of the previous visible line (only one ellipsis no matter how
778 many invisible lines follow).
780 All editing commands treat the text of the invisible line as part of
781 the previous visible line. For example, `C-n' moves onto the next
782 visible line. Killing an entire visible line, including its
783 terminating newline, really kills all the following invisible lines as
784 well; yanking everything back yanks the invisible lines and they remain
789 * Format: Outline Format. What the text of an outline looks like.
790 * Motion: Outline Motion. Special commands for moving through outlines.
791 * Visibility: Outline Visibility. Commands to control what is visible.
794 File: xemacs.info, Node: Outline Format, Next: Outline Motion, Prev: Outline Mode, Up: Outline Mode
799 Outline mode assumes that the lines in the buffer are of two types:
800 "heading lines" and "body lines". A heading line represents a topic in
801 the outline. Heading lines start with one or more stars; the number of
802 stars determines the depth of the heading in the outline structure.
803 Thus, a heading line with one star is a major topic; all the heading
804 lines with two stars between it and the next one-star heading are its
805 subtopics; and so on. Any line that is not a heading line is a body
806 line. Body lines belong to the preceding heading line. Here is an
812 which says something about the topic of food.
816 This is the body of the second-level header.
828 A second first-level topic with its header line.
830 A heading line together with all following body lines is called
831 collectively an "entry". A heading line together with all following
832 deeper heading lines and their body lines is called a "subtree".
834 You can customize the criterion for distinguishing heading lines by
835 setting the variable `outline-regexp'. Any line whose beginning has a
836 match for this regexp is considered a heading line. Matches that start
837 within a line (not at the beginning) do not count. The length of the
838 matching text determines the level of the heading; longer matches make
839 a more deeply nested level. Thus, for example, if a text formatter has
840 commands `@chapter', `@section' and `@subsection' to divide the
841 document into chapters and sections, you can make those lines count as
842 heading lines by setting `outline-regexp' to
843 `"@chap\\|@\\(sub\\)*section"'. Note the trick: the two words
844 `chapter' and `section' are the same length, but by defining the regexp
845 to match only `chap' we ensure that the length of the text matched on a
846 chapter heading is shorter, so that Outline mode will know that
847 sections are contained in chapters. This works as long as no other
848 command starts with `@chap'.
850 Outline mode makes a line invisible by changing the newline before it
851 into an ASCII Control-M (code 015). Most editing commands that work on
852 lines treat an invisible line as part of the previous line because,
853 strictly speaking, it is part of that line, since there is no longer a
854 newline in between. When you save the file in Outline mode, Control-M
855 characters are saved as newlines, so the invisible lines become ordinary
856 lines in the file. Saving does not change the visibility status of a
860 File: xemacs.info, Node: Outline Motion, Next: Outline Visibility, Prev: Outline Format, Up: Outline Mode
862 Outline Motion Commands
863 .......................
865 Some special commands in Outline mode move backward and forward to
869 Move point to the next visible heading line
870 (`outline-next-visible-heading').
873 Move point to the previous visible heading line
874 (`outline-previous-visible-heading').
877 Move point to the next visible heading line at the same level as
878 the one point is on (`outline-forward-same-level').
881 Move point to the previous visible heading line at the same level
882 (`outline-backward-same-level').
885 Move point up to a lower-level (more inclusive) visible heading
886 line (`outline-up-heading').
888 `C-c C-n' (`next-visible-heading') moves down to the next heading
889 line. `C-c C-p' (`previous-visible-heading') moves similarly backward.
890 Both accept numeric arguments as repeat counts. The names emphasize
891 that invisible headings are skipped, but this is not really a special
892 feature. All editing commands that look for lines ignore the invisible
895 More advanced motion commands understand the levels of headings.
896 The commands `C-c C-f' (`outline-forward-same-level') and `C-c C-b'
897 (`outline-backward-same-level') move from one heading line to another
898 visible heading at the same depth in the outline. `C-c C-u'
899 (`outline-up-heading') moves backward to another heading that is less
903 File: xemacs.info, Node: Outline Visibility, Prev: Outline Motion, Up: Outline Mode
905 Outline Visibility Commands
906 ...........................
908 The other special commands of outline mode are used to make lines
909 visible or invisible. Their names all start with `hide' or `show'.
910 Most of them exist as pairs of opposites. They are not undoable;
911 instead, you can undo right past them. Making lines visible or
912 invisible is simply not recorded by the undo mechanism.
915 Make all body lines in the buffer invisible.
918 Make all lines in the buffer visible.
921 Make everything under this heading invisible, not including this
922 heading itself (`hide-subtree').
925 Make everything under this heading visible, including body,
926 subheadings, and their bodies (`show-subtree').
929 Make the body of this heading line, and of all its subheadings,
933 Make all subheadings of this heading line, at all levels, visible.
936 Make immediate subheadings (one level down) of this heading line
937 visible (`show-children').
940 Make this heading line's body invisible.
943 Make this heading line's body visible.
945 Two commands that are exact opposites are `M-x hide-entry' and `M-x
946 show-entry'. They are used with point on a heading line, and apply
947 only to the body lines of that heading. The subtopics and their bodies
950 Two more powerful opposites are `C-c C-h' (`hide-subtree') and `C-c
951 C-s' (`show-subtree'). Both should be used when point is on a heading
952 line, and both apply to all the lines of that heading's "subtree": its
953 body, all its subheadings, both direct and indirect, and all of their
954 bodies. In other words, the subtree contains everything following this
955 heading line, up to and not including the next heading of the same or
958 Intermediate between a visible subtree and an invisible one is having
959 all the subheadings visible but none of the body. There are two
960 commands for doing this, one that hides the bodies and one that makes
961 the subheadings visible. They are `M-x hide-leaves' and `M-x
964 A little weaker than `show-branches' is `C-c C-i' (`show-children').
965 It makes just the direct subheadings visible--those one level down.
966 Deeper subheadings remain invisible.
968 Two commands have a blanket effect on the whole file. `M-x
969 hide-body' makes all body lines invisible, so that you see just the
970 outline structure. `M-x show-all' makes all lines visible. You can
971 think of these commands as a pair of opposites even though `M-x
972 show-all' applies to more than just body lines.
974 You can turn off the use of ellipses at the ends of visible lines by
975 setting `selective-display-ellipses' to `nil'. The result is no
976 visible indication of the presence of invisible lines.
979 File: xemacs.info, Node: Words, Next: Sentences, Prev: Text Mode, Up: Text
984 Emacs has commands for moving over or operating on words. By
985 convention, the keys for them are all `Meta-' characters.
988 Move forward over a word (`forward-word').
991 Move backward over a word (`backward-word').
994 Kill up to the end of a word (`kill-word').
997 Kill back to the beginning of a word (`backward-kill-word').
1000 Mark the end of the next word (`mark-word').
1003 Transpose two words; drag a word forward or backward across other
1004 words (`transpose-words').
1006 Notice how these keys form a series that parallels the
1007 character-based `C-f', `C-b', `C-d', `C-t' and <DEL>. `M-@' is related
1008 to `C-@', which is an alias for `C-<SPC>'.
1010 The commands `Meta-f' (`forward-word') and `Meta-b'
1011 (`backward-word') move forward and backward over words. They are
1012 analogous to `Control-f' and `Control-b', which move over single
1013 characters. Like their `Control-' analogues, `Meta-f' and `Meta-b'
1014 move several words if given an argument. `Meta-f' with a negative
1015 argument moves backward, and `Meta-b' with a negative argument moves
1016 forward. Forward motion stops after the last letter of the word, while
1017 backward motion stops before the first letter.
1019 `Meta-d' (`kill-word') kills the word after point. To be precise,
1020 it kills everything from point to the place `Meta-f' would move to.
1021 Thus, if point is in the middle of a word, `Meta-d' kills just the part
1022 after point. If some punctuation comes between point and the next
1023 word, it is killed along with the word. (To kill only the next word
1024 but not the punctuation before it, simply type `Meta-f' to get to the
1025 end and kill the word backwards with `Meta-<DEL>'.) `Meta-d' takes
1026 arguments just like `Meta-f'.
1028 `Meta-<DEL>' (`backward-kill-word') kills the word before point. It
1029 kills everything from point back to where `Meta-b' would move to. If
1030 point is after the space in `FOO, BAR', then `FOO, ' is killed. To
1031 kill just `FOO', type `Meta-b Meta-d' instead of `Meta-<DEL>'.
1033 `Meta-t' (`transpose-words') exchanges the word before or containing
1034 point with the following word. The delimiter characters between the
1035 words do not move. For example, transposing `FOO, BAR' results in
1036 `BAR, FOO' rather than `BAR FOO,'. *Note Transpose::, for more on
1037 transposition and on arguments to transposition commands.
1039 To operate on the next N words with an operation which applies
1040 between point and mark, you can either set the mark at point and then
1041 move over the words, or you can use the command `Meta-@' (`mark-word')
1042 which does not move point but sets the mark where `Meta-f' would move
1043 to. It can be given arguments just like `Meta-f'.
1045 The word commands' understanding of syntax is completely controlled
1046 by the syntax table. For example, any character can be declared to be
1047 a word delimiter. *Note Syntax::.
1050 File: xemacs.info, Node: Sentences, Next: Paragraphs, Prev: Words, Up: Text
1055 The Emacs commands for manipulating sentences and paragraphs are
1056 mostly on `Meta-' keys, and therefore are like the word-handling
1060 Move back to the beginning of the sentence (`backward-sentence').
1063 Move forward to the end of the sentence (`forward-sentence').
1066 Kill forward to the end of the sentence (`kill-sentence').
1069 Kill back to the beginning of the sentence
1070 (`backward-kill-sentence').
1072 The commands `Meta-a' and `Meta-e' (`backward-sentence' and
1073 `forward-sentence') move to the beginning and end of the current
1074 sentence, respectively. They resemble `Control-a' and `Control-e',
1075 which move to the beginning and end of a line. Unlike their
1076 counterparts, `Meta-a' and `Meta-e' move over successive sentences if
1077 repeated or given numeric arguments. Emacs assumes the typist's
1078 convention is followed, and thus considers a sentence to end wherever
1079 there is a `.', `?', or `!' followed by the end of a line or two
1080 spaces, with any number of `)', `]', `'', or `"' characters allowed in
1081 between. A sentence also begins or ends wherever a paragraph begins or
1084 Neither `M-a' nor `M-e' moves past the newline or spaces beyond the
1085 sentence edge at which it is stopping.
1087 `M-a' and `M-e' have a corresponding kill command, just like `C-a'
1088 and `C-e' have `C-k'. The command is `M-k' (`kill-sentence') which
1089 kills from point to the end of the sentence. With minus one as an
1090 argument it kills back to the beginning of the sentence. Larger
1091 arguments serve as repeat counts.
1093 There is a special command, `C-x <DEL>' (`backward-kill-sentence'),
1094 for killing back to the beginning of a sentence, which is useful when
1095 you change your mind in the middle of composing text.
1097 The variable `sentence-end' controls recognition of the end of a
1098 sentence. It is a regexp that matches the last few characters of a
1099 sentence, together with the whitespace following the sentence. Its
1102 "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*"
1104 This example is explained in the section on regexps. *Note Regexps::.
1107 File: xemacs.info, Node: Paragraphs, Next: Pages, Prev: Sentences, Up: Text
1112 The Emacs commands for manipulating paragraphs are also `Meta-' keys.
1115 Move back to previous paragraph beginning
1116 (`backward-paragraph').
1119 Move forward to next paragraph end (`forward-paragraph').
1122 Put point and mark around this or next paragraph
1125 `Meta-[' moves to the beginning of the current or previous paragraph,
1126 while `Meta-]' moves to the end of the current or next paragraph.
1127 Blank lines and text formatter command lines separate paragraphs and are
1128 not part of any paragraph. An indented line starts a new paragraph.
1130 In major modes for programs (as opposed to Text mode), paragraphs
1131 begin and end only at blank lines. As a result, the paragraph commands
1132 continue to be useful even though there are no paragraphs per se.
1134 When there is a fill prefix, paragraphs are delimited by all lines
1135 which don't start with the fill prefix. *Note Filling::.
1137 To operate on a paragraph, you can use the command `Meta-h'
1138 (`mark-paragraph') to set the region around it. This command puts
1139 point at the beginning and mark at the end of the paragraph point was
1140 in. If point is between paragraphs (in a run of blank lines or at a
1141 boundary), the paragraph following point is surrounded by point and
1142 mark. If there are blank lines preceding the first line of the
1143 paragraph, one of the blank lines is included in the region. Thus, for
1144 example, `M-h C-w' kills the paragraph around or after point.
1146 The precise definition of a paragraph boundary is controlled by the
1147 variables `paragraph-separate' and `paragraph-start'. The value of
1148 `paragraph-start' is a regexp that matches any line that either starts
1149 or separates paragraphs. The value of `paragraph-separate' is another
1150 regexp that matches only lines that separate paragraphs without being
1151 part of any paragraph. Lines that start a new paragraph and are
1152 contained in it must match both regexps. For example, normally
1153 `paragraph-start' is `"^[ \t\n\f]"' and `paragraph-separate' is `"^[
1156 Normally it is desirable for page boundaries to separate paragraphs.
1157 The default values of these variables recognize the usual separator for