aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-05 00:19:57 +0800
committerChong Yidong2011-12-05 00:19:57 +0800
commitec7ae0329e5cfda066433f8c5d5daa6e0d1dde14 (patch)
treef0c898ab4e8b7e1e7810c09048fa1934be063be2
parent6d5eb5b0d2e50b0dd153a988cc52492cb77fc333 (diff)
downloademacs-ec7ae0329e5cfda066433f8c5d5daa6e0d1dde14.tar.gz
emacs-ec7ae0329e5cfda066433f8c5d5daa6e0d1dde14.zip
Updates to Programs chapter of Emacs manual.
* programs.texi (Program Modes): Mention modes that are not included with Emacs. Fix references to other manuals for tex. Add index entry for backward-delete-char-untabify. Mention prog-mode-hook. (Which Function): Use "global minor mode" terminology. (Basic Indent, Multi-line Indent): Refer to previous descriptions in Indentation chapter to avoid duplication. (Expressions): Copyedit. (Matching): Document Electric Pair mode. * ack.texi (Acknowledgments): * rmail.texi (Movemail, Other Mailbox Formats): * frames.texi (Frames): Don't capitalize "Unix".
-rw-r--r--doc/emacs/ChangeLog16
-rw-r--r--doc/emacs/ack.texi4
-rw-r--r--doc/emacs/frames.texi2
-rw-r--r--doc/emacs/programs.texi453
-rw-r--r--doc/emacs/rmail.texi27
-rw-r--r--doc/emacs/text.texi20
6 files changed, 265 insertions, 257 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index e55c1026786..df1812d27ec 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,5 +1,21 @@
12011-12-04 Chong Yidong <cyd@gnu.org> 12011-12-04 Chong Yidong <cyd@gnu.org>
2 2
3 * programs.texi (Program Modes): Mention modes that are not
4 included with Emacs. Fix references to other manuals for tex.
5 Add index entry for backward-delete-char-untabify. Mention
6 prog-mode-hook.
7 (Which Function): Use "global minor mode" terminology.
8 (Basic Indent, Multi-line Indent): Refer to previous descriptions
9 in Indentation chapter to avoid duplication.
10 (Expressions): Copyedit.
11 (Matching): Document Electric Pair mode.
12
13 * ack.texi (Acknowledgments):
14 * rmail.texi (Movemail, Other Mailbox Formats):
15 * frames.texi (Frames): Don't capitalize "Unix".
16
172011-12-04 Chong Yidong <cyd@gnu.org>
18
3 * text.texi (Nroff Mode): Mention what nroff is. 19 * text.texi (Nroff Mode): Mention what nroff is.
4 (Text Based Tables, Table Recognition): Don't say "Table mode" 20 (Text Based Tables, Table Recognition): Don't say "Table mode"
5 since it's not a major or minor mode. 21 since it's not a major or minor mode.
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index d7022ba739b..ae6338ce5a6 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -1272,8 +1272,8 @@ Colin Walters wrote Ibuffer, an enhanced buffer menu.
1272Barry Warsaw wrote @file{assoc.el}, a set of utility functions for 1272Barry Warsaw wrote @file{assoc.el}, a set of utility functions for
1273working with association lists; @file{cc-mode.el}, a mode for editing 1273working with association lists; @file{cc-mode.el}, a mode for editing
1274C, C@t{++}, and Java code, based on earlier work by Dave Detlefs, 1274C, C@t{++}, and Java code, based on earlier work by Dave Detlefs,
1275Stewart Clamen, and Richard Stallman; @file{elp.el}, a profiler 1275Stewart Clamen, and Richard Stallman; @file{elp.el}, a profiler for
1276for Emacs Lisp programs; @file{man.el}, a mode for reading UNIX manual 1276Emacs Lisp programs; @file{man.el}, a mode for reading Unix manual
1277pages; @file{regi.el}, providing an AWK-like functionality for use in 1277pages; @file{regi.el}, providing an AWK-like functionality for use in
1278lisp programs; @file{reporter.el}, providing customizable bug 1278lisp programs; @file{reporter.el}, providing customizable bug
1279reporting for lisp packages; and @file{supercite.el}, a minor mode for 1279reporting for lisp packages; and @file{supercite.el}, a minor mode for
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 1445d25be15..dec5aa771ea 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -32,7 +32,7 @@ unavailable. However, it is still possible to create multiple
32``frames'' on text-only terminals; such frames are displayed one at a 32``frames'' on text-only terminals; such frames are displayed one at a
33time, filling the entire terminal screen (@pxref{Non-Window 33time, filling the entire terminal screen (@pxref{Non-Window
34Terminals}). It is also possible to use the mouse on some text-only 34Terminals}). It is also possible to use the mouse on some text-only
35terminals (@pxref{Text-Only Mouse}, for doing so on GNU and UNIX 35terminals (@pxref{Text-Only Mouse}, for doing so on GNU and Unix
36systems; and 36systems; and
37@iftex 37@iftex
38@pxref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features}, 38@pxref{MS-DOS Mouse,,,emacs-xtra,Specialized Emacs Features},
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 675977c2c35..66f7a49faab 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -8,8 +8,8 @@
8@cindex C editing 8@cindex C editing
9@cindex program editing 9@cindex program editing
10 10
11 Emacs provides many features to facilitate editing programs. Some 11 This chapter describes Emacs features for facilitating editing
12of these features can 12programs. Some of these features can:
13 13
14@itemize @bullet 14@itemize @bullet
15@item 15@item
@@ -25,8 +25,6 @@ Insert, kill or align comments (@pxref{Comments}).
25Highlight program syntax (@pxref{Font Lock}). 25Highlight program syntax (@pxref{Font Lock}).
26@end itemize 26@end itemize
27 27
28 This chapter describes these features and many more.
29
30@menu 28@menu
31* Program Modes:: Major modes for editing programs. 29* Program Modes:: Major modes for editing programs.
32* Defuns:: Commands to operate on major top-level parts 30* Defuns:: Commands to operate on major top-level parts
@@ -52,21 +50,14 @@ Highlight program syntax (@pxref{Font Lock}).
52@section Major Modes for Programming Languages 50@section Major Modes for Programming Languages
53@cindex modes for programming languages 51@cindex modes for programming languages
54 52
55 Emacs has specialized major modes for various programming languages. 53 Emacs has specialized major modes (@pxref{Major Modes}) for many
56@xref{Major Modes}. A programming language major mode typically 54programming languages. A programming language mode typically
57specifies the syntax of expressions, the customary rules for 55specifies the syntax of expressions, the customary rules for
58indentation, how to do syntax highlighting for the language, and how 56indentation, how to do syntax highlighting for the language, and how
59to find the beginning or end of a function definition. It often 57to find the beginning or end of a function definition. It often has
60customizes or provides facilities for compiling and debugging programs 58features for compiling and debugging programs as well. The major mode
61as well. 59for each language is named after the language; for instance, the major
62 60mode for the C programming language is @code{c-mode}.
63 Ideally, Emacs should provide a major mode for each programming
64language that you might want to edit; if it doesn't have a mode for
65your favorite language, you can contribute one. But often the mode
66for one language can serve for other syntactically similar languages.
67The major mode for language @var{l} is called @code{@var{l}-mode},
68and you can select it by typing @kbd{M-x @var{l}-mode @key{RET}}.
69@xref{Choosing Modes}.
70 61
71@cindex Perl mode 62@cindex Perl mode
72@cindex Icon mode 63@cindex Icon mode
@@ -89,40 +80,32 @@ and you can select it by typing @kbd{M-x @var{l}-mode @key{RET}}.
89@cindex Conf mode 80@cindex Conf mode
90@cindex DNS mode 81@cindex DNS mode
91@cindex Javascript mode 82@cindex Javascript mode
92 The existing programming language major modes include Lisp, Scheme 83 Emacs has programming language modes for Lisp, Scheme, the
93(a variant of Lisp) and the Scheme-based DSSSL expression language, 84Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, Delphi,
94Ada, ASM, AWK, C, C++, Delphi (Object Pascal), Fortran, Icon, IDL 85Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, Metafont
95(CORBA), IDLWAVE, Java, Javascript, Metafont (@TeX{}'s companion for 86(@TeX{}'s companion for font creation), Modula2, Objective-C, Octave,
96font creation), Modula2, Objective-C, Octave, Pascal, Perl, Pike, 87Pascal, Perl, Pike, PostScript, Prolog, Python, Ruby, Simula, Tcl, and
97PostScript, Prolog, Python, Ruby, Simula, Tcl, and VHDL. An 88VHDL. An alternative mode for Perl is called CPerl mode. Modes are
98alternative mode for Perl is called CPerl mode. Modes are available 89also available for the scripting languages of the common GNU and Unix
99for the scripting languages of the common GNU and Unix shells, VMS 90shells, VMS DCL, and MS-DOS/MS-Windows @samp{BAT} files, and for
100DCL, and MS-DOS/MS-Windows @samp{BAT} files. There are also major 91makefiles, DNS master files, and various sorts of configuration files.
101modes for editing makefiles, DNS master files, and various sorts of 92
102configuration files. 93 Ideally, Emacs should have a major mode for each programming
94language that you might want to edit. If it doesn't have a mode for
95your favorite language, the mode might be implemented in a package not
96distributed with Emacs (@pxref{Packages}); or you can contribute one.
103 97
104@kindex DEL @r{(programming modes)} 98@kindex DEL @r{(programming modes)}
105@findex c-electric-backspace 99@findex c-electric-backspace
100@findex backward-delete-char-untabify
106 In most programming languages, indentation should vary from line to 101 In most programming languages, indentation should vary from line to
107line to illustrate the structure of the program. So the major modes 102line to illustrate the structure of the program. Therefore, in most
108for programming languages arrange for @key{TAB} to update the 103programming language modes, typing @key{TAB} updates the indentation
109indentation of the current line (@pxref{Program Indent}). They also 104of the current line (@pxref{Program Indent}). Furthermore, @key{DEL}
110rebind @key{DEL} to treat a tab as if it were the equivalent number of 105is usually bound to @code{backward-delete-char-untabify}, which
111spaces; this lets you delete one column of indentation without 106deletes backward treating each tab as if it were the equivalent number
112worrying whether the whitespace consists of spaces or tabs. Use 107of spaces, so that you can delete one column of indentation without
113@kbd{C-b C-d} to delete a tab character before point, in these modes. 108worrying whether the whitespace consists of spaces or tabs.
114
115 Separate manuals are available for the modes for Ada (@pxref{Top, , Ada
116Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK
117(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
118(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}). For Fortran
119mode, see
120@iftex
121@ref{Fortran,,, emacs-xtra, Specialized Emacs Features}.
122@end iftex
123@ifnottex
124@ref{Fortran}.
125@end ifnottex
126 109
127@cindex mode hook 110@cindex mode hook
128@vindex c-mode-hook 111@vindex c-mode-hook
@@ -130,13 +113,24 @@ mode, see
130@vindex emacs-lisp-mode-hook 113@vindex emacs-lisp-mode-hook
131@vindex lisp-interaction-mode-hook 114@vindex lisp-interaction-mode-hook
132@vindex scheme-mode-hook 115@vindex scheme-mode-hook
133 Turning on a major mode runs a normal hook called the @dfn{mode 116 Entering a programming language mode runs the custom Lisp functions
134hook}, which is the value of a Lisp variable. Each major mode has a 117specified in the hook variable @code{prog-mode-hook}, followed by
135mode hook, and the hook's name is always made from the mode command's 118those specified in the mode's own mode hook (@pxref{Major Modes}).
136name by adding @samp{-hook}. For example, turning on C mode runs the 119For instance, entering C mode runs the hooks @code{prog-mode-hook} and
137hook @code{c-mode-hook}, while turning on Lisp mode runs the hook 120@code{c-mode-hook}. @xref{Hooks}, for information about hooks.
138@code{lisp-mode-hook}. The purpose of the mode hook is to give you a 121
139place to set up customizations for that major mode. @xref{Hooks}. 122@ifinfo
123 Separate manuals are available for the modes for Ada (@pxref{Top,,
124Ada Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba
125IDL/Pike/AWK (@pxref{Top, , CC Mode, ccmode, CC Mode}), and IDLWAVE
126(@pxref{Top,, IDLWAVE, idlwave, IDLWAVE User Manual}).
127@end ifinfo
128@ifnotinfo
129 The Emacs distribution contains Info manuals for the major modes for
130Ada, C/C++/Objective C/Java/Corba IDL/Pike/AWK, and IDLWAVE. For
131Fortran mode, see the ``Fortran'' section in the Info version of the
132Emacs manual, which is not included in this printed version.
133@end ifnotinfo
140 134
141@node Defuns 135@node Defuns
142@section Top-Level Definitions, or Defuns 136@section Top-Level Definitions, or Defuns
@@ -328,20 +322,19 @@ The Speedbar can also use it (@pxref{Speedbar}).
328@subsection Which Function Mode 322@subsection Which Function Mode
329@cindex current function name in mode line 323@cindex current function name in mode line
330 324
331 Which Function mode is a minor mode that displays the current 325 Which Function mode is a global minor mode (@pxref{Minor Modes})
332function name in the mode line, updating it as you move around in a 326which displays the current function name in the mode line, updating it
333buffer. 327as you move around in a buffer.
334 328
335@findex which-function-mode 329@findex which-function-mode
336@vindex which-func-modes 330@vindex which-func-modes
337 To either enable or disable Which Function mode, use the command 331 To either enable or disable Which Function mode, use the command
338@kbd{M-x which-function-mode}. This command applies to all buffers, 332@kbd{M-x which-function-mode}. Although Which Function mode is a
339both existing ones and those yet to be created. However, it takes 333global minor mode, it takes effect only in certain major modes: those
340effect only in certain major modes, those listed in the value of 334listed in the variable @code{which-func-modes}. If the value of
341@code{which-func-modes}. If the value of @code{which-func-modes} is 335@code{which-func-modes} is @code{t} rather than a list of modes, then
342@code{t} rather than a list of modes, then Which Function mode applies 336Which Function mode applies to all major modes that know how to
343to all major modes that know how to support it---in other words, all 337support it---in other words, all the major modes that support Imenu.
344the major modes that support Imenu.
345 338
346@node Program Indent 339@node Program Indent
347@section Indentation for Programs 340@section Indentation for Programs
@@ -352,6 +345,10 @@ reindent it as you change it. Emacs has commands to indent either a
352single line, a specified number of lines, or all of the lines inside a 345single line, a specified number of lines, or all of the lines inside a
353single parenthetical grouping. 346single parenthetical grouping.
354 347
348 @xref{Indentation}, for general information about indentation. This
349section describes indentation features specific to programming
350language modes.
351
355@menu 352@menu
356* Basic Indent:: Indenting a single line. 353* Basic Indent:: Indenting a single line.
357* Multi-line Indent:: Commands to reindent many lines at once. 354* Multi-line Indent:: Commands to reindent many lines at once.
@@ -361,18 +358,15 @@ single parenthetical grouping.
361@end menu 358@end menu
362 359
363@cindex pretty-printer 360@cindex pretty-printer
364 Emacs also provides a Lisp pretty-printer in the library @code{pp}. 361 Emacs also provides a Lisp pretty-printer in the @code{pp} package,
365This program reformats a Lisp object with indentation chosen to look nice. 362which reformats Lisp objects with nice-looking indentation.
366 363
367@node Basic Indent 364@node Basic Indent
368@subsection Basic Program Indentation Commands 365@subsection Basic Program Indentation Commands
369 366
370 The basic indentation commands indent a single line according to the
371usual conventions of the language you are editing.
372
373@table @kbd 367@table @kbd
374@item @key{TAB} 368@item @key{TAB}
375Adjust indentation of current line. 369Adjust indentation of current line (@code{indent-for-tab-command}).
376@item C-j 370@item C-j
377Insert a newline, then adjust indentation of following line 371Insert a newline, then adjust indentation of following line
378(@code{newline-and-indent}). 372(@code{newline-and-indent}).
@@ -382,65 +376,50 @@ Insert a newline, then adjust indentation of following line
382@findex c-indent-command 376@findex c-indent-command
383@findex indent-line-function 377@findex indent-line-function
384@findex indent-for-tab-command 378@findex indent-for-tab-command
385 The basic indentation command is @key{TAB}. In any 379 The basic indentation command is @key{TAB}
386programming-language major mode, @key{TAB} gives the current line the 380(@code{indent-for-tab-command}), which was documented in
387correct indentation as determined from the previous lines. It does 381@ref{Indentation}. In programming language modes, @key{TAB} indents
388this by inserting or deleting whitespace at the beginning of the 382the current line, based on the indentation and syntactic content of
389current line. If point was inside the whitespace at the beginning of 383the preceding lines; if the region is active, @key{TAB} indents each
390the line, @key{TAB} puts it at the end of that whitespace; otherwise, 384line within the region, not just the current line.
391@key{TAB} keeps point fixed with respect to the characters around it.
392If the region is active (@pxref{Mark}), @key{TAB} indents every line
393within the region instead of just the current line. The function that
394@key{TAB} runs depends on the major mode; for instance, it is
395@code{c-indent-line-or-region} in C mode. Each function is aware of
396the syntax and conventions for its particular language.
397
398 Use @kbd{C-q @key{TAB}} to insert a tab character at point.
399 385
400@kindex C-j @r{(indenting source code)} 386@kindex C-j @r{(indenting source code)}
401@findex newline-and-indent 387@findex newline-and-indent
402 When entering lines of new code, use @kbd{C-j} 388 The command @kbd{C-j} (@code{newline-and-indent}), which was
403(@code{newline-and-indent}), which inserts a newline and then adjusts 389documented in @ref{Indentation Commands}, does the same as @key{RET}
404indentation after it. (It also deletes any trailing whitespace which 390followed by @key{TAB}: it inserts a new line, then adjusts the line's
405remains before the new newline.) For instance, @kbd{C-j} at the end 391indentation.
406of a line creates a blank line with appropriate indentation. In 392
407programming language modes, it is equivalent to @key{RET} @key{TAB}. 393 When indenting a line that starts within a parenthetical grouping,
408 394Emacs usually places the start of the line under the preceding line
409 When Emacs indents a line that starts within a parenthetical 395within the group, or under the text after the parenthesis. If you
410grouping, it usually places the start of the line under the preceding 396manually give one of these lines a nonstandard indentation (e.g.@: for
411line within the group, or under the text after the parenthesis. If 397aesthetic purposes), the lines below will follow it.
412you manually give one of these lines a nonstandard indentation, the 398
413lines below will tend to follow it. This behavior is convenient in 399 The indentation commands for most programming language modes assume
414cases where you have overridden the standard result of @key{TAB} 400that a open-parenthesis, open-brace or other opening delimiter at the
415indentation (e.g., for aesthetic purposes). 401left margin is the start of a function. If the code you are editing
416 402violates this assumption---even if the delimiters occur in strings or
417 Many programming-language modes assume that an open-parenthesis, 403comments---you must set @code{open-paren-in-column-0-is-defun-start}
418open-brace or other opening delimiter at the left margin is the start 404to @code{nil} for indentation to work properly. @xref{Left Margin
419of a function. This assumption speeds up indentation commands. If
420the text you are editing contains opening delimiters in column zero
421that aren't the beginning of a functions---even if these delimiters
422occur inside strings or comments---then you must set
423@code{open-paren-in-column-0-is-defun-start}. @xref{Left Margin
424Paren}. 405Paren}.
425 406
426 Normally, Emacs indents lines using an ``optimal'' mix of tab and
427space characters. If you want Emacs to use spaces only, set
428@code{indent-tabs-mode} (@pxref{Just Spaces}).
429
430@node Multi-line Indent 407@node Multi-line Indent
431@subsection Indenting Several Lines 408@subsection Indenting Several Lines
432 409
433 Sometimes, you may want to reindent several lines of code at a time. 410 Sometimes, you may want to reindent several lines of code at a time.
434One way to do this is to use the mark; when the mark is active and the 411One way to do this is to use the mark; when the mark is active and the
435region is non-empty, @key{TAB} indents every line within the region. 412region is non-empty, @key{TAB} indents every line in the region.
436In addition, Emacs provides several other commands for indenting large 413Alternatively, the command @kbd{C-M-\} (@code{indent-region}) indents
437chunks of code: 414every line in the region, whether or not the mark is active
415(@pxref{Indentation Commands}).
416
417 In addition, Emacs provides the following commands for indenting
418large chunks of code:
438 419
439@table @kbd 420@table @kbd
440@item C-M-q 421@item C-M-q
441Reindent all the lines within one parenthetical grouping. 422Reindent all the lines within one parenthetical grouping.
442@item C-M-\
443Reindent all lines in the region (@code{indent-region}).
444@item C-u @key{TAB} 423@item C-u @key{TAB}
445Shift an entire parenthetical grouping rigidly sideways so that its 424Shift an entire parenthetical grouping rigidly sideways so that its
446first line is properly indented. 425first line is properly indented.
@@ -454,18 +433,13 @@ lines that start inside comments and strings.
454 To reindent the contents of a single parenthetical grouping, 433 To reindent the contents of a single parenthetical grouping,
455position point before the beginning of the grouping and type 434position point before the beginning of the grouping and type
456@kbd{C-M-q}. This changes the relative indentation within the 435@kbd{C-M-q}. This changes the relative indentation within the
457grouping, without affecting its overall indentation (i.e., the 436grouping, without affecting its overall indentation (i.e.@: the
458indentation of the line where the grouping starts). The function that 437indentation of the line where the grouping starts). The function that
459@kbd{C-M-q} runs depends on the major mode; it is 438@kbd{C-M-q} runs depends on the major mode; it is
460@code{indent-pp-sexp} in Lisp mode, @code{c-indent-exp} in C mode, 439@code{indent-pp-sexp} in Lisp mode, @code{c-indent-exp} in C mode,
461etc. To correct the overall indentation as well, type @key{TAB} 440etc. To correct the overall indentation as well, type @key{TAB}
462first. 441first.
463 442
464 @kbd{C-M-\} (@code{indent-region}) applies @key{TAB} to the region.
465This is useful when Transient Mark mode is disabled (@pxref{Disabled
466Transient Mark}), because in that case @key{TAB} does not act on the
467region.
468
469@kindex C-u TAB 443@kindex C-u TAB
470 If you like the relative indentation within a grouping but not the 444 If you like the relative indentation within a grouping but not the
471indentation of its first line, move point to that first line and type 445indentation of its first line, move point to that first line and type
@@ -516,9 +490,9 @@ expression.
516@cindex @code{lisp-indent-function} property 490@cindex @code{lisp-indent-function} property
517 You can override the standard pattern in various ways for individual 491 You can override the standard pattern in various ways for individual
518functions, according to the @code{lisp-indent-function} property of 492functions, according to the @code{lisp-indent-function} property of
519the function name. Normally you would use this for macro definitions 493the function name. This is normally done for macro definitions, using
520and specify it using the @code{declare} construct (@pxref{Defining 494the @code{declare} construct. @xref{Defining Macros,,, elisp, the
521Macros,,, elisp, the Emacs Lisp Reference Manual}). 495Emacs Lisp Reference Manual}.
522 496
523@node C Indent 497@node C Indent
524@subsection Commands for C Indentation 498@subsection Commands for C Indentation
@@ -664,9 +638,13 @@ parentheses and unbalanced string quotes in the buffer.
664@cindex sexp 638@cindex sexp
665@cindex expression 639@cindex expression
666@cindex balanced expression 640@cindex balanced expression
667 These commands deal with balanced expressions, also called 641 Each programming language mode has its own definition of a
668@dfn{sexps}@footnote{The word ``sexp'' is used to refer to an 642@dfn{balanced expression}. Balanced expressions typically include
669expression in Lisp.}. 643individual symbols, numbers, and string constants, as well as pieces
644of code enclosed in a matching pair of delimiters. The following
645commands deal with balanced expressions (in Emacs, such expressions
646are referred to internally as @dfn{sexps}@footnote{The word ``sexp''
647is used to refer to an expression in Lisp.}).
670 648
671@table @kbd 649@table @kbd
672@item C-M-f 650@item C-M-f
@@ -682,90 +660,71 @@ Transpose expressions (@code{transpose-sexps}).
682Put mark after following expression (@code{mark-sexp}). 660Put mark after following expression (@code{mark-sexp}).
683@end table 661@end table
684 662
685 Each programming language major mode customizes the definition of
686balanced expressions to suit that language. Balanced expressions
687typically include symbols, numbers, and string constants, as well as
688any pair of matching delimiters and their contents. Some languages
689have obscure forms of expression syntax that nobody has bothered to
690implement in Emacs.
691
692@cindex Control-Meta
693 By convention, the keys for these commands are all Control-Meta
694characters. They usually act on expressions just as the corresponding
695Meta characters act on words. For instance, the command @kbd{C-M-b}
696moves backward over a balanced expression, just as @kbd{M-b} moves
697back over a word.
698
699@kindex C-M-f 663@kindex C-M-f
700@kindex C-M-b 664@kindex C-M-b
701@findex forward-sexp 665@findex forward-sexp
702@findex backward-sexp 666@findex backward-sexp
703 To move forward over a balanced expression, use @kbd{C-M-f} 667 To move forward over a balanced expression, use @kbd{C-M-f}
704(@code{forward-sexp}). If the first significant character after point 668(@code{forward-sexp}). If the first significant character after point
705is an opening delimiter (@samp{(} in Lisp; @samp{(}, @samp{[} or 669is an opening delimiter (e.g.@: @samp{(}, @samp{[} or @samp{@{} in C),
706@samp{@{} in C), @kbd{C-M-f} moves past the matching closing 670this command moves past the matching closing delimiter. If the
707delimiter. If the character begins a symbol, string, or number, 671character begins a symbol, string, or number, the command moves over
708@kbd{C-M-f} moves over that. 672that.
709 673
710 The command @kbd{C-M-b} (@code{backward-sexp}) moves backward over a 674 The command @kbd{C-M-b} (@code{backward-sexp}) moves backward over a
711balanced expression. The detailed rules are like those above for 675balanced expression---like @kbd{C-M-f}, but in the reverse direction.
712@kbd{C-M-f}, but with directions reversed. If there are prefix 676If the expression is preceded by any prefix characters (single-quote,
713characters (single-quote, backquote and comma, in Lisp) preceding the 677backquote and comma, in Lisp), the command moves back over them as
714expression, @kbd{C-M-b} moves back over them as well. The balanced 678well.
715expression commands move across comments as if they were whitespace, 679
716in most modes. 680 @kbd{C-M-f} or @kbd{C-M-b} with an argument repeats that operation
717 681the specified number of times; with a negative argument means to move
718 @kbd{C-M-f} or @kbd{C-M-b} with an argument repeats that operation the 682in the opposite direction. In most modes, these two commands move
719specified number of times; with a negative argument, it moves in the 683across comments as if they were whitespace. Note that their keys,
720opposite direction. 684@kbd{C-M-f} and @kbd{C-M-b}, are analogous to @kbd{C-f} and @kbd{C-b},
685which move by characters (@pxref{Moving Point}), and @kbd{M-f} and
686@kbd{M-b}, which move by words (@pxref{Words}).
721 687
722@cindex killing expressions 688@cindex killing expressions
723@kindex C-M-k 689@kindex C-M-k
724@findex kill-sexp 690@findex kill-sexp
725 Killing a whole balanced expression can be done with @kbd{C-M-k} 691 To kill a whole balanced expression, type @kbd{C-M-k}
726(@code{kill-sexp}). @kbd{C-M-k} kills the characters that @kbd{C-M-f} 692(@code{kill-sexp}). This kills the text that @kbd{C-M-f} would move
727would move over. 693over.
728 694
729@cindex transposition of expressions 695@cindex transposition of expressions
730@kindex C-M-t 696@kindex C-M-t
731@findex transpose-sexps 697@findex transpose-sexps
732 A somewhat random-sounding command which is nevertheless handy is 698 @kbd{C-M-t} (@code{transpose-sexps}) switches the positions of the
733@kbd{C-M-t} (@code{transpose-sexps}), which drags the previous 699previous balanced expression and the next one. It is analogous to the
734balanced expression across the next one. An argument serves as a 700@kbd{C-t} command, which transposes characters (@pxref{Transpose}).
735repeat count, moving the previous expression over that many following 701An argument to @kbd{C-M-t} serves as a repeat count, moving the
736ones. A negative argument drags the previous balanced expression 702previous expression over that many following ones. A negative
737backwards across those before it (thus canceling out the effect of 703argument moves the previous balanced expression backwards across those
738@kbd{C-M-t} with a positive argument). An argument of zero, rather 704before it. An argument of zero, rather than doing nothing, transposes
739than doing nothing, transposes the balanced expressions ending at or 705the balanced expressions ending at or after point and the mark.
740after point and the mark.
741 706
742@kindex C-M-@@ 707@kindex C-M-@@
743@kindex C-M-@key{SPC} 708@kindex C-M-@key{SPC}
744@findex mark-sexp 709@findex mark-sexp
745 To operate on balanced expressions with an operation which acts on 710 To operate on balanced expressions with a command which acts on the
746the region, use the command @kbd{C-M-@key{SPC}} (@code{mark-sexp}). 711region, type @kbd{C-M-@key{SPC}} (@code{mark-sexp}). This sets the
747This sets the mark at the same place that @kbd{C-M-f} would move to. 712mark where @kbd{C-M-f} would move to. While the mark is active, each
748@xref{Marking Objects}, for more information about this command. 713successive call to this command extends the region by shifting the
749 714mark by one expression. Positive or negative numeric arguments move
750@kbd{C-M-@key{SPC}} treats 715the mark forward or backward by the specified number of expressions.
751numeric arguments in the same way as @kbd{C-M-f}; in particular, a 716The alias @kbd{C-M-@@} is equivalent to @kbd{C-M-@key{SPC}}.
752negative argument puts the mark at the beginning of the previous 717@xref{Marking Objects}, for more information about this and related
753balanced expression. The alias @kbd{C-M-@@} is equivalent to 718commands.
754@kbd{C-M-@key{SPC}}. While the mark is active, each successive use of
755@kbd{C-M-@key{SPC}} extends the region by shifting the mark by one
756sexp.
757 719
758 In languages that use infix operators, such as C, it is not possible 720 In languages that use infix operators, such as C, it is not possible
759to recognize all balanced expressions as such because there can be 721to recognize all balanced expressions because there can be multiple
760multiple possibilities at a given position. For example, C mode does 722possibilities at a given position. For example, C mode does not treat
761not treat @samp{foo + bar} as a single expression, even though it 723@samp{foo + bar} as a single expression, even though it @emph{is} one
762@emph{is} one C expression; instead, it recognizes @samp{foo} as one 724C expression; instead, it recognizes @samp{foo} as one expression and
763expression and @samp{bar} as another, with the @samp{+} as punctuation 725@samp{bar} as another, with the @samp{+} as punctuation between them.
764between them. Both @samp{foo + bar} and @samp{foo} are legitimate 726However, C mode recognizes @samp{(foo + bar)} as a single expression,
765choices for ``the expression following point'' when point is at the 727because of the parentheses.
766@samp{f}, so the expression commands must perforce choose one or the
767other to operate on. Note that @samp{(foo + bar)} is recognized as a
768single expression in C mode, because of the parentheses.
769 728
770@node Moving by Parens 729@node Moving by Parens
771@subsection Moving in the Parenthesis Structure 730@subsection Moving in the Parenthesis Structure
@@ -776,19 +735,18 @@ single expression in C mode, because of the parentheses.
776@cindex braces, moving across 735@cindex braces, moving across
777@cindex list commands 736@cindex list commands
778 737
779 The Emacs commands for handling parenthetical groupings see nothing 738 The following commands move over groupings delimited by parentheses
780except parentheses (or whatever characters must balance in the 739(or whatever else serves as delimiters in the language you are working
781language you are working with). They ignore strings and comments 740with). They ignore strings and comments, including any parentheses
782(including any parentheses within them) and ignore parentheses quoted 741within them, and also ignore parentheses that are ``quoted'' with an
783by an escape character. They are mainly intended for editing 742escape character. These commands are mainly intended for editing
784programs, but can be useful for editing any text that has parentheses. 743programs, but can be useful for editing any text containing
785They are sometimes called ``list'' commands because in Lisp these 744parentheses. They are referred to internally as ``list'' commands
786groupings are lists. 745because in Lisp these groupings are lists.
787 746
788These commands assume that the starting point is not inside a string 747 These commands assume that the starting point is not inside a string
789or a comment. Sometimes you can invoke them usefully from one of 748or a comment. If you invoke them from inside a string or comment, the
790these places (for example, when you have a parenthesised clause in a 749results are unreliable.
791comment) but this is unreliable.
792 750
793@table @kbd 751@table @kbd
794@item C-M-n 752@item C-M-n
@@ -826,52 +784,62 @@ delimiter, this is nearly the same as searching for a @samp{(}. An
826argument specifies the number of levels to go down. 784argument specifies the number of levels to go down.
827 785
828@node Matching 786@node Matching
829@subsection Automatic Display Of Matching Parentheses 787@subsection Matching Parentheses
830@cindex matching parentheses 788@cindex matching parentheses
831@cindex parentheses, displaying matches 789@cindex parentheses, displaying matches
832 790
833 The Emacs parenthesis-matching feature is designed to show 791 Emacs has a number of @dfn{parenthesis matching} features, which
834automatically how parentheses (and other matching delimiters) match in 792make it easy to see how and whether parentheses (or other delimiters)
835the text. Whenever you type a self-inserting character that is a 793match up.
836closing delimiter, the cursor moves momentarily to the location of the 794
795 Whenever you type a self-inserting character that is a closing
796delimiter, the cursor moves momentarily to the location of the
837matching opening delimiter, provided that is on the screen. If it is 797matching opening delimiter, provided that is on the screen. If it is
838not on the screen, Emacs displays some of the text near it in the echo 798not on the screen, Emacs displays some of the text near it in the echo
839area. Either way, you can tell which grouping you are closing off. 799area. Either way, you can tell which grouping you are closing off.
840 800If the opening delimiter and closing delimiter are mismatched---such
841 If the opening delimiter and closing delimiter are mismatched---such
842as in @samp{[x)}---a warning message is displayed in the echo area. 801as in @samp{[x)}---a warning message is displayed in the echo area.
843 802
844@vindex blink-matching-paren 803@vindex blink-matching-paren
845@vindex blink-matching-paren-distance 804@vindex blink-matching-paren-distance
846@vindex blink-matching-delay 805@vindex blink-matching-delay
847 Three variables control parenthesis match display: 806 Three variables control the display of matching parentheses:
848 807
849 @code{blink-matching-paren} turns the feature on or off: @code{nil} 808@itemize @bullet
850disables it, but the default is @code{t} to enable match display. 809@item
810@code{blink-matching-paren} turns the feature on or off: @code{nil}
811disables it, but the default is @code{t} to enable it.
851 812
852 @code{blink-matching-delay} says how many seconds to leave the 813@item
853cursor on the matching opening delimiter, before bringing it back to 814@code{blink-matching-delay} says how many seconds to leave the cursor
854the real location of point; the default is 1, but on some systems it 815on the matching opening delimiter, before bringing it back to the real
855is useful to specify a fraction of a second. 816location of point. This may be an integer or floating-point number;
817the default is 1.
856 818
857 @code{blink-matching-paren-distance} specifies how many characters 819@item
820@code{blink-matching-paren-distance} specifies how many characters
858back to search to find the matching opening delimiter. If the match 821back to search to find the matching opening delimiter. If the match
859is not found in that distance, scanning stops, and nothing is displayed. 822is not found in that distance, Emacs stops scanning and nothing is
860This is to prevent the scan for the matching delimiter from wasting 823displayed. The default is 102400.
861lots of time when there is no match. The default is 102400. 824@end itemize
862 825
863@cindex Show Paren mode 826@cindex Show Paren mode
864@cindex highlighting matching parentheses 827@cindex highlighting matching parentheses
865@findex show-paren-mode 828@findex show-paren-mode
866 Show Paren mode provides a more powerful kind of automatic matching. 829 Show Paren mode, a global minor mode, provides a more powerful kind
867Whenever point is before an opening delimiter or after a closing 830of automatic matching. Whenever point is before an opening delimiter
868delimiter, both that delimiter and its opposite delimiter are 831or after a closing delimiter, both that delimiter and its opposite
869highlighted. Use the command @kbd{M-x show-paren-mode} to enable or 832delimiter are highlighted. To toggle Show Paren mode, type @kbd{M-x
870disable this mode. 833show-paren-mode}.
871 834
872 Show Paren mode uses the faces @code{show-paren-match} and 835@cindex Electric Pair mode
873@code{show-paren-mismatch} to highlight parentheses; you can customize 836@cindex inserting matching parentheses
874them to control how highlighting looks. @xref{Face Customization}. 837@findex electric-pair-mode
838 Electric Pair mode, a global minor mode, provides a way to easily
839insert matching delimiters. Whenever you insert an opening delimiter,
840the matching closing delimiter is automatically inserted as well,
841leaving point between the two. To toggle Electric Pair mode, type
842@kbd{M-x electric-pair-mode}.
875 843
876@node Comments 844@node Comments
877@section Manipulating Comments 845@section Manipulating Comments
@@ -1220,8 +1188,13 @@ pops up a window with possible candidates asking you to choose one of
1220them. 1188them.
1221 1189
1222 For more information about setting up and using @kbd{M-x woman}, see 1190 For more information about setting up and using @kbd{M-x woman}, see
1223@ref{Top, WoMan, Browse UN*X Manual Pages WithOut Man, woman, The WoMan 1191@ifinfo
1224Manual}. 1192@ref{Top, WoMan, Browse UN*X Manual Pages WithOut Man, woman, The
1193WoMan Manual}.
1194@end ifinfo
1195@ifnotinfo
1196the WoMan Info manual, which is distributed with Emacs.
1197@end ifnotinfo
1225 1198
1226@node Lisp Doc 1199@node Lisp Doc
1227@subsection Emacs Lisp Documentation Lookup 1200@subsection Emacs Lisp Documentation Lookup
@@ -1400,13 +1373,12 @@ to use Glasses mode.
1400 1373
1401Semantic is a package that provides language-aware editing commands 1374Semantic is a package that provides language-aware editing commands
1402based on @code{source code parsers}. This section provides a brief 1375based on @code{source code parsers}. This section provides a brief
1403description of Semantic; 1376description of Semantic; for full details,
1404@ifnottex 1377@ifnottex
1405for full details, see @ref{Top, Semantic,, semantic, Semantic}. 1378see @ref{Top, Semantic,, semantic, Semantic}.
1406@end ifnottex 1379@end ifnottex
1407@iftex 1380@iftex
1408for full details, type @kbd{C-h i} (@code{info}) and then select the 1381see the Semantic Info manual, which is distributed with Emacs.
1409Semantic manual.
1410@end iftex 1382@end iftex
1411 1383
1412 Most of the ``language aware'' features in Emacs, such as font lock 1384 Most of the ``language aware'' features in Emacs, such as font lock
@@ -1486,8 +1458,10 @@ Programming modes often support Outline minor mode (@pxref{Outline
1486Mode}). The Foldout package provides folding-editor features 1458Mode}). The Foldout package provides folding-editor features
1487(@pxref{Foldout}). 1459(@pxref{Foldout}).
1488 1460
1461@ifinfo
1489 The ``automatic typing'' features may be useful for writing programs. 1462 The ``automatic typing'' features may be useful for writing programs.
1490@xref{Top,,Autotyping, autotype, Autotyping}. 1463@xref{Top,,Autotyping, autotype, Autotyping}.
1464@end ifinfo
1491 1465
1492@node C Modes 1466@node C Modes
1493@section C and Related Modes 1467@section C and Related Modes
@@ -1509,9 +1483,14 @@ Mode}). The Foldout package provides folding-editor features
1509 1483
1510 This section gives a brief description of the special features 1484 This section gives a brief description of the special features
1511available in C, C++, Objective-C, Java, CORBA IDL, Pike and AWK modes. 1485available in C, C++, Objective-C, Java, CORBA IDL, Pike and AWK modes.
1512(These are called ``C mode and related modes.'') @xref{Top, , CC Mode, 1486(These are called ``C mode and related modes.'')
1513ccmode, CC Mode}, for a more extensive description of these modes 1487@ifinfo
1514and their special features. 1488@xref{Top,, CC Mode, ccmode, CC Mode}, for more details.
1489@end ifinfo
1490@ifnotinfo
1491For more details, see the CC mode Info manual, which is distributed
1492with Emacs.
1493@end ifnotinfo
1515 1494
1516@menu 1495@menu
1517* Motion in C:: Commands to move by C statements, etc. 1496* Motion in C:: Commands to move by C statements, etc.
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi
index 0df4a3a7bb5..d05af468fa1 100644
--- a/doc/emacs/rmail.texi
+++ b/doc/emacs/rmail.texi
@@ -1340,17 +1340,18 @@ included in GNU mailutils (the ``mailutils version,''
1340command line syntax and the same basic subset of options. However, the 1340command line syntax and the same basic subset of options. However, the
1341Mailutils version offers additional features. 1341Mailutils version offers additional features.
1342 1342
1343 The Emacs version of @code{movemail} is able to retrieve mail from the 1343 The Emacs version of @code{movemail} is able to retrieve mail from
1344usual UNIX mailbox formats and from remote mailboxes using the POP3 1344the usual Unix mailbox formats and from remote mailboxes using the
1345protocol. 1345POP3 protocol.
1346 1346
1347 The Mailutils version is able to handle a wide set of mailbox 1347 The Mailutils version is able to handle a wide set of mailbox
1348formats, such as plain UNIX mailboxes, @code{maildir} and @code{MH} 1348formats, such as plain Unix mailboxes, @code{maildir} and @code{MH}
1349mailboxes, etc. It is able to access remote mailboxes using the POP3 or 1349mailboxes, etc. It is able to access remote mailboxes using the POP3
1350IMAP4 protocol, and can retrieve mail from them using a TLS encrypted 1350or IMAP4 protocol, and can retrieve mail from them using a TLS
1351channel. It also accepts mailbox arguments in @acronym{URL} form. 1351encrypted channel. It also accepts mailbox arguments in @acronym{URL}
1352The detailed description of mailbox @acronym{URL}s can be found in 1352form. The detailed description of mailbox @acronym{URL}s can be found
1353@ref{URL,,,mailutils,Mailbox URL Formats}. In short, a @acronym{URL} is: 1353in @ref{URL,,,mailutils,Mailbox URL Formats}. In short, a
1354@acronym{URL} is:
1354 1355
1355@smallexample 1356@smallexample
1356@var{proto}://[@var{user}[:@var{password}]@@]@var{host-or-file-name} 1357@var{proto}://[@var{user}[:@var{password}]@@]@var{host-or-file-name}
@@ -1381,9 +1382,9 @@ local mailbox.
1381 1382
1382@table @code 1383@table @code
1383@item mbox 1384@item mbox
1384Usual UNIX mailbox format. In this case, neither @var{user} nor 1385Usual Unix mailbox format. In this case, neither @var{user} nor
1385@var{pass} are used, and @var{host-or-file-name} denotes the file name of 1386@var{pass} are used, and @var{host-or-file-name} denotes the file name
1386the mailbox file, e.g., @code{mbox://var/spool/mail/smith}. 1387of the mailbox file, e.g., @code{mbox://var/spool/mail/smith}.
1387 1388
1388@item mh 1389@item mh
1389A local mailbox in the @acronym{MH} format. @var{User} and 1390A local mailbox in the @acronym{MH} format. @var{User} and
@@ -1524,7 +1525,7 @@ use it, add the @samp{--tls} flag to @code{rmail-movemail-flags}.
1524@section Retrieving Mail from Local Mailboxes in Various Formats 1525@section Retrieving Mail from Local Mailboxes in Various Formats
1525 1526
1526 If your incoming mail is stored on a local machine in a format other 1527 If your incoming mail is stored on a local machine in a format other
1527than UNIX mailbox, you will need the Mailutils @code{movemail} to 1528than Unix mailbox, you will need the Mailutils @code{movemail} to
1528retrieve it. @xref{Movemail}, for the detailed description of 1529retrieve it. @xref{Movemail}, for the detailed description of
1529@code{movemail} versions. For example, to access mail from a inbox in 1530@code{movemail} versions. For example, to access mail from a inbox in
1530@code{maildir} format located in @file{/var/spool/mail/in}, you would 1531@code{maildir} format located in @file{/var/spool/mail/in}, you would
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 72b793246f1..c27a2c2936d 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -32,9 +32,14 @@ structure.
32@findex nxml-mode 32@findex nxml-mode
33 Emacs has other major modes for text which contains ``embedded'' 33 Emacs has other major modes for text which contains ``embedded''
34commands, such as @TeX{} and La@TeX{} (@pxref{TeX Mode}); HTML and 34commands, such as @TeX{} and La@TeX{} (@pxref{TeX Mode}); HTML and
35SGML (@pxref{HTML Mode}); XML (@pxref{Top,The nXML Mode 35SGML (@pxref{HTML Mode}); XML
36Manual,,nxml-mode, nXML Mode}); and Groff and Nroff (@pxref{Nroff 36@ifinfo
37Mode}). 37(@pxref{Top,The nXML Mode Manual,,nxml-mode, nXML Mode});
38@end ifinfo
39@ifnotinfo
40(see the nXML mode Info manual, which is distributed with Emacs);
41@end ifnotinfo
42and Groff and Nroff (@pxref{Nroff Mode}).
38 43
39@cindex ASCII art 44@cindex ASCII art
40 If you need to edit pictures made out of text characters (commonly 45 If you need to edit pictures made out of text characters (commonly
@@ -1764,8 +1769,15 @@ xml-mode}. Emacs uses nXML mode for files which have the extension
1764@file{.xml}. For XHTML files, which have the extension @file{.xhtml}, 1769@file{.xml}. For XHTML files, which have the extension @file{.xhtml},
1765Emacs uses HTML mode by default; you can make it use nXML mode by 1770Emacs uses HTML mode by default; you can make it use nXML mode by
1766customizing the variable @code{auto-mode-alist} (@pxref{Choosing 1771customizing the variable @code{auto-mode-alist} (@pxref{Choosing
1767Modes}). nXML mode is described in its own manual: @xref{Top, nXML 1772Modes}).
1773@ifinfo
1774nXML mode is described in its own manual: @xref{Top, nXML
1768Mode,,nxml-mode, nXML Mode}. 1775Mode,,nxml-mode, nXML Mode}.
1776@end ifinfo
1777@ifnotinfo
1778nXML mode is described in an Info manual, which is distributed with
1779Emacs.
1780@end ifnotinfo
1769 1781
1770@vindex sgml-xml-mode 1782@vindex sgml-xml-mode
1771 You may choose to use the less powerful SGML mode for editing XML, 1783 You may choose to use the less powerful SGML mode for editing XML,