aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog51
-rw-r--r--doc/emacs/Makefile.in2
-rw-r--r--doc/emacs/ack.texi18
-rw-r--r--doc/emacs/cmdargs.texi9
-rw-r--r--doc/emacs/custom.texi183
-rw-r--r--doc/emacs/emacs.texi53
-rw-r--r--doc/emacs/frames.texi181
-rw-r--r--doc/emacs/glossary.texi5
-rw-r--r--doc/emacs/help.texi10
-rw-r--r--doc/emacs/indent.texi2
-rw-r--r--doc/emacs/killing.texi339
-rw-r--r--doc/emacs/major.texi237
-rw-r--r--doc/emacs/makefile.w32-in2
-rw-r--r--doc/emacs/misc.texi4
-rw-r--r--doc/emacs/modes.texi410
-rw-r--r--doc/emacs/mule.texi2
-rw-r--r--doc/emacs/programs.texi5
-rw-r--r--doc/emacs/screen.texi2
-rw-r--r--doc/emacs/search.texi13
-rw-r--r--doc/emacs/text.texi95
-rw-r--r--doc/lispref/ChangeLog8
-rw-r--r--doc/lispref/modes.texi9
-rw-r--r--doc/lispref/text.texi15
23 files changed, 814 insertions, 841 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 87d1211587f..ae732a7db0f 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,54 @@
12011-07-11 Chong Yidong <cyd@stupidchicken.com>
2
3 * killing.texi (Killing, Deletion and Killing, Killing by Lines)
4 (Other Kill Commands, Kill Options): Copyedits.
5 (Deletion and Killing, Kill Ring): Kill/yank now use clipboard.
6 (Yanking): Move yank-excluded properties discussion here.
7 (Cut and Paste): Move from frames.texi. Update subnodes to
8 describe x-select-enable-clipboard case.
9
10 * frames.texi: Move Cut and Paste node and subnodes into
11 killing.texi, except Mouse Commands and Word and Line Mouse.
12
132011-07-10 Andy Moreton <andrewjmoreton@gmail.com> (tiny change)
14
15 * makefile.w32-in (EMACSSOURCES): Replace major.texi with modes.texi.
16
172011-07-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
18
19 * screen.texi (Mode Line): Clarify that coding systems are
20 characters, not letters (bug#1749).
21
22 * cmdargs.texi (Environment): Mention removing variables
23 (bug#1615). Text suggested by Kevin Rodgers.
24
252011-07-10 Chong Yidong <cyd@stupidchicken.com>
26
27 * misc.texi (Amusements): Don't mention Yow; it's crippled.
28
29 * modes.texi: Rename from major.texi.
30 (Modes): New node. Make Major Modes and Minor Modes subsections
31 of this. All callers changed.
32
33 * custom.texi (Minor Modes): Move to modes.texi.
34
352011-07-10 Chong Yidong <cyd@stupidchicken.com>
36
37 * custom.texi (Syntax): Node deleted.
38
39 * help.texi (Help Summary):
40 * major.texi (Major Modes):
41 * programs.texi (Parentheses):
42 * search.texi (Regexp Backslash, Regexp Backslash)
43 (Regexp Backslash):
44 * text.texi (Words): Callers changed.
45
46 * text.texi (Refill, Longlines): Delete nodes.
47
48 * ack.texi (Acknowledgments): Longlines removed from manual.
49
50 * emacs.texi (Top): Update node listing.
51
12011-07-09 Glenn Morris <rgm@gnu.org> 522011-07-09 Glenn Morris <rgm@gnu.org>
2 53
3 * fortran-xtra.texi (Fortran): Update handled extensions. 54 * fortran-xtra.texi (Fortran): Update handled extensions.
diff --git a/doc/emacs/Makefile.in b/doc/emacs/Makefile.in
index aca17ce817d..9465c726eba 100644
--- a/doc/emacs/Makefile.in
+++ b/doc/emacs/Makefile.in
@@ -84,7 +84,7 @@ EMACSSOURCES= \
84 ${srcdir}/windows.texi \ 84 ${srcdir}/windows.texi \
85 ${srcdir}/frames.texi \ 85 ${srcdir}/frames.texi \
86 ${srcdir}/mule.texi \ 86 ${srcdir}/mule.texi \
87 ${srcdir}/major.texi \ 87 ${srcdir}/modes.texi \
88 ${srcdir}/indent.texi \ 88 ${srcdir}/indent.texi \
89 ${srcdir}/text.texi \ 89 ${srcdir}/text.texi \
90 ${srcdir}/programs.texi \ 90 ${srcdir}/programs.texi \
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index e554c71703f..1cfb3d9ffe9 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -190,9 +190,7 @@ prior to Emacs 23 for Mac OS.
190 190
191@item 191@item
192Chong Yidong was the Emacs co-maintainer for Emacs 23. He made many 192Chong Yidong was the Emacs co-maintainer for Emacs 23. He made many
193improvements to the Emacs display engine; and, together with Kai 193improvements to the Emacs display engine.
194Großjohann and Alex Schroeder, wrote @file{longlines.el}, a minor
195mode for wrapping long lines.
196 194
197@item 195@item
198James Clark wrote SGML mode, a mode for editing SGML documents; and 196James Clark wrote SGML mode, a mode for editing SGML documents; and
@@ -689,14 +687,12 @@ the current window on which point is; @file{cap-words.el}, a minor mode
689for motion in ``CapitalizedWordIdentifiers''; @file{latin1-disp.el}, a 687for motion in ``CapitalizedWordIdentifiers''; @file{latin1-disp.el}, a
690package that lets you display ISO 8859 characters on Latin-1 terminals 688package that lets you display ISO 8859 characters on Latin-1 terminals
691by setting up appropriate display tables; @file{python.el}, a major mode 689by setting up appropriate display tables; @file{python.el}, a major mode
692for the Python programming language; @file{refill.el}, a mode for 690for the Python programming language; @file{smiley.el}, a facility for
693automatic paragraph refilling, akin to typical word processors; 691displaying smiley faces; @file{sym-comp.el}, a library for performing
694@file{smiley.el}, a facility for displaying smiley faces; 692mode-dependent symbol completion; @file{benchmark.el} for timing code
695@file{sym-comp.el}, a library for performing mode-dependent symbol 693execution; and @file{tool-bar.el}, a mode to control the display of
696completion; @file{benchmark.el} for timing code execution; and 694the Emacs tool bar. With Riccardo Murri he wrote @file{vc-bzr.el},
697@file{tool-bar.el}, a mode to control the display of the Emacs tool bar. 695support for the Bazaar version control system.
698With Riccardo Murri he wrote @file{vc-bzr.el}, support for the Bazaar
699version control system.
700 696
701@item 697@item
702Eric Ludlam wrote the Speedbar package; @file{checkdoc.el}, for checking 698Eric Ludlam wrote the Speedbar package; @file{checkdoc.el}, for checking
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 1c3b85559d2..af493ade2f2 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -427,10 +427,11 @@ software) inherit the environment from Emacs, too.
427@vindex initial-environment 427@vindex initial-environment
428 Inside Emacs, the command @kbd{M-x getenv} gets the value of an 428 Inside Emacs, the command @kbd{M-x getenv} gets the value of an
429environment variable. @kbd{M-x setenv} sets a variable in the Emacs 429environment variable. @kbd{M-x setenv} sets a variable in the Emacs
430environment. (Environment variable substitutions with @samp{$} work 430environment, and @kbd{C-u M-x setenv} removes a variable.
431in the value just as in file names; see @ref{File Names with $}.) The 431(Environment variable substitutions with @samp{$} work in the value
432variable @code{initial-environment} stores the initial environment 432just as in file names; see @ref{File Names with $}.) The variable
433inherited by Emacs. 433@code{initial-environment} stores the initial environment inherited by
434Emacs.
434 435
435 The way to set environment variables outside of Emacs depends on the 436 The way to set environment variables outside of Emacs depends on the
436operating system, and especially the shell that you are using. For 437operating system, and especially the shell that you are using. For
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 434c574ac42..8465dd93519 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -23,169 +23,16 @@ Reference Manual}.
23@end ifnottex 23@end ifnottex
24 24
25@menu 25@menu
26* Minor Modes:: Each minor mode is a feature you can turn on
27 independently of any others.
28* Easy Customization:: Convenient way to browse and change settings. 26* Easy Customization:: Convenient way to browse and change settings.
29* Variables:: Many Emacs commands examine Emacs variables 27* Variables:: Many Emacs commands examine Emacs variables
30 to decide what to do; by setting variables, 28 to decide what to do; by setting variables,
31 you can control their functioning. 29 you can control their functioning.
32* Key Bindings:: The keymaps say what command each key runs. 30* Key Bindings:: The keymaps say what command each key runs.
33 By changing them, you can "redefine keys". 31 By changing them, you can "redefine keys".
34* Syntax:: The syntax table controls how words and
35 expressions are parsed.
36* Init File:: How to write common customizations in the 32* Init File:: How to write common customizations in the
37 @file{.emacs} file. 33 @file{.emacs} file.
38@end menu 34@end menu
39 35
40@node Minor Modes
41@section Minor Modes
42@cindex minor modes
43@cindex mode, minor
44
45 Minor modes are optional features which you can turn on or off. For
46example, Auto Fill mode is a minor mode in which @key{SPC} breaks
47lines between words as you type. Minor modes are independent of one
48another and of the selected major mode. Most minor modes say in the
49mode line when they are enabled; for example, @samp{Fill} in the mode
50line means that Auto Fill mode is enabled.
51
52 Each minor mode is associated with a command, called the @dfn{mode
53command}, which turns it on or off. The name of this command consists
54of the name of the minor mode, followed by @samp{-mode}; for instance,
55the mode command for Auto Fill mode is @code{auto-fill-mode}. Calling
56the minor mode command with no prefix argument @dfn{toggles} the mode,
57turning it on if it was off, and off if it was on. A positive
58argument always turns the mode on, and a zero or negative argument
59always turns it off. Mode commands are usually invoked with
60@kbd{M-x}, but you can bind keys to them if you wish (@pxref{Key
61Bindings}).
62
63 Most minor modes also have a @dfn{mode variable}, with the same name
64as the mode command. Its value is non-@code{nil} if the mode is
65enabled, and @code{nil} if it is disabled. In some minor modes---but
66not all---the value of the variable alone determines whether the mode
67is active: the mode command works simply by setting the variable, and
68changing the value of the variable has the same effect as calling the
69mode command. Because not all minor modes work this way, we recommend
70that you avoid changing the mode variables directly; use the mode
71commands instead.
72
73 Some minor modes are @dfn{buffer-local}: they apply only to the
74current buffer, so you can enable the mode in certain buffers and not
75others. Other minor modes are @dfn{global}: while enabled, they
76affect everything you do in the Emacs session, in all buffers. Some
77global minor modes are enabled by default.
78
79 The following is a list of some buffer-local minor modes:
80
81@itemize @bullet
82@item
83Abbrev mode automatically expands text based on pre-defined
84abbreviation definitions. @xref{Abbrevs}.
85
86@item
87Auto Fill mode inserts newlines as you type to prevent lines from
88becoming too long. @xref{Filling}.
89
90@item
91Auto Save mode saves the buffer contents periodically to reduce the
92amount of work you can lose in case of a crash. @xref{Auto Save}.
93
94@item
95Enriched mode enables editing and saving of formatted text.
96@xref{Formatted Text}.
97
98@item
99Flyspell mode automatically highlights misspelled words.
100@xref{Spelling}.
101
102@item
103Font-Lock mode automatically highlights certain textual units found in
104programs. It is enabled globally by default, but you can disable it
105in individual buffers. @xref{Faces}.
106
107@findex linum-mode
108@cindex Linum mode
109@item
110Linum mode displays each line's line number in the window's left
111margin. Its mode command is @code{linum-mode}.
112
113@item
114Outline minor mode provides similar facilities to the major mode
115called Outline mode. @xref{Outline Mode}.
116
117@cindex Overwrite mode
118@cindex mode, Overwrite
119@findex overwrite-mode
120@kindex INSERT
121@item
122Overwrite mode causes ordinary printing characters to replace existing
123text instead of shoving it to the right. For example, if point is in
124front of the @samp{B} in @samp{FOOBAR}, then in Overwrite mode typing
125a @kbd{G} changes it to @samp{FOOGAR}, instead of producing
126@samp{FOOGBAR} as usual. In Overwrite mode, the command @kbd{C-q}
127inserts the next character whatever it may be, even if it is a
128digit---this gives you a way to insert a character instead of
129replacing an existing character. The mode command,
130@code{overwrite-mode}, is bound to the @key{Insert} key.
131
132@findex binary-overwrite-mode
133@item
134Binary Overwrite mode is a variant of Overwrite mode for editing
135binary files; it treats newlines and tabs like other characters, so
136that they overwrite other characters and can be overwritten by them.
137In Binary Overwrite mode, digits after @kbd{C-q} specify an octal
138character code, as usual.
139
140@item
141Visual Line mode performs ``word wrapping'', causing long lines to be
142wrapped at word boundaries. @xref{Visual Line Mode}.
143@end itemize
144
145 Here are some useful global minor modes. Since Line Number mode and
146Transient Mark mode can be enabled or disabled just by setting the
147value of the minor mode variable, you @emph{can} set them differently
148for particular buffers, by explicitly making the corresponding
149variable local in those buffers. @xref{Locals}.
150
151@itemize @bullet
152@item
153Column Number mode enables display of the current column number in the
154mode line. @xref{Mode Line}.
155
156@item
157Delete Selection mode causes text insertion to first delete the text
158in the region, if the region is active. @xref{Using Region}.
159
160@item
161Icomplete mode displays an indication of available completions when
162you are in the minibuffer and completion is active. @xref{Completion
163Options}.
164
165@item
166Line Number mode enables display of the current line number in the
167mode line. It is enabled by default. @xref{Mode Line}.
168
169@item
170Menu Bar mode gives each frame a menu bar. It is enabled by default.
171@xref{Menu Bars}.
172
173@item
174Scroll Bar mode gives each window a scroll bar. It is enabled by
175default, but the scroll bar is only displayed on graphical terminals.
176@xref{Scroll Bars}.
177
178@item
179Tool Bar mode gives each frame a tool bar. It is enabled by default,
180but the tool bar is only displayed on graphical terminals. @xref{Tool
181Bars}.
182
183@item
184Transient Mark mode highlights the region, and makes many Emacs
185commands operate on the region when the mark is active. It is enabled
186by default. @xref{Mark}.
187@end itemize
188
189@node Easy Customization 36@node Easy Customization
190@section Easy Customization Interface 37@section Easy Customization Interface
191 38
@@ -2085,36 +1932,6 @@ invoke it; disabling also applies if the command is invoked using
2085@kbd{M-x}. However, disabling a command has no effect on calling it 1932@kbd{M-x}. However, disabling a command has no effect on calling it
2086as a function from Lisp programs. 1933as a function from Lisp programs.
2087 1934
2088@node Syntax
2089@section The Syntax Table
2090@cindex syntax table
2091
2092 All the Emacs commands which parse words or balance parentheses are
2093controlled by the @dfn{syntax table}. The syntax table says which
2094characters are opening delimiters, which are parts of words, which are
2095string quotes, and so on. It does this by assigning each character to
2096one of fifteen-odd @dfn{syntax classes}. In some cases it specifies
2097some additional information also.
2098
2099 Each major mode has its own syntax table (though related major modes
2100sometimes share one syntax table), which it installs in each buffer
2101that uses the mode. The syntax table installed in the current buffer
2102is the one that all commands use, so we call it ``the'' syntax table.
2103
2104@kindex C-h s
2105@findex describe-syntax
2106 To display a description of the contents of the current syntax
2107table, type @kbd{C-h s} (@code{describe-syntax}). The description of
2108each character includes the string you would have to give to
2109@code{modify-syntax-entry} to set up that character's current syntax,
2110starting with the character which designates its syntax class, plus
2111some English text to explain its meaning.
2112
2113 A syntax table is actually a Lisp object, a char-table, whose
2114elements are cons cells. For full information on the syntax table,
2115see @ref{Syntax Tables,, Syntax Tables, elisp, The Emacs Lisp
2116Reference Manual}.
2117
2118@node Init File 1935@node Init File
2119@section The Init File, @file{~/.emacs} 1936@section The Init File, @file{~/.emacs}
2120@cindex init file 1937@cindex init file
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index ed7d48877e5..a35736f4fe7 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -167,16 +167,15 @@ Important Text-Changing Commands
167* Mark:: The mark: how to delimit a ``region'' of text. 167* Mark:: The mark: how to delimit a ``region'' of text.
168* Killing:: Killing (cutting) text. 168* Killing:: Killing (cutting) text.
169* Yanking:: Recovering killed text. Moving text. (Pasting.) 169* Yanking:: Recovering killed text. Moving text. (Pasting.)
170* Cut and Paste:: Clipboard and selections on graphical displays.
170* Accumulating Text:: Other ways of copying text. 171* Accumulating Text:: Other ways of copying text.
171* Rectangles:: Operating on the text inside a rectangle on the screen. 172* Rectangles:: Operating on text in rectangular areas.
172* CUA Bindings:: Using @kbd{C-x}, @kbd{C-c}, @kbd{C-v} for copy 173* CUA Bindings:: Using @kbd{C-x}, @kbd{C-c}, @kbd{C-v} to kill and yank.
173 and paste, with enhanced rectangle support.
174* Registers:: Saving a text string or a location in the buffer. 174* Registers:: Saving a text string or a location in the buffer.
175* Display:: Controlling what text is displayed. 175* Display:: Controlling what text is displayed.
176* Search:: Finding or replacing occurrences of a string. 176* Search:: Finding or replacing occurrences of a string.
177* Fixit:: Commands especially useful for fixing typos. 177* Fixit:: Commands especially useful for fixing typos.
178* Keyboard Macros:: A keyboard macro records a sequence of 178* Keyboard Macros:: Recording a sequence of keystrokes to be replayed.
179 keystrokes to be replayed with a single command.
180 179
181Major Structures of Emacs 180Major Structures of Emacs
182* Files:: All about handling files. 181* Files:: All about handling files.
@@ -186,13 +185,13 @@ Major Structures of Emacs
186* International:: Using non-@acronym{ASCII} character sets. 185* International:: Using non-@acronym{ASCII} character sets.
187 186
188Advanced Features 187Advanced Features
189* Major Modes:: Text mode vs. Lisp mode vs. C mode... 188* Modes:: Major and minor modes alter Emacs' basic behavior.
190* Indentation:: Editing the white space at the beginnings of lines. 189* Indentation:: Editing the white space at the beginnings of lines.
191* Text:: Commands and modes for editing English. 190* Text:: Commands and modes for editing English.
192* Programs:: Commands and modes for editing programs. 191* Programs:: Commands and modes for editing programs.
193* Building:: Compiling, running and debugging programs. 192* Building:: Compiling, running and debugging programs.
194* Maintaining:: Features for maintaining large programs. 193* Maintaining:: Features for maintaining large programs.
195* Abbrevs:: How to define text abbreviations to reduce 194* Abbrevs:: Defining text abbreviations to reduce
196 the number of characters you must type. 195 the number of characters you must type.
197@c AFAICS, the tex stuff generates its own index and does not use this one. 196@c AFAICS, the tex stuff generates its own index and does not use this one.
198@ifnottex 197@ifnottex
@@ -204,9 +203,9 @@ Advanced Features
204* Dired:: You can ``edit'' a directory to manage files in it. 203* Dired:: You can ``edit'' a directory to manage files in it.
205* Calendar/Diary:: The calendar and diary facilities. 204* Calendar/Diary:: The calendar and diary facilities.
206* Document View:: Viewing PDF, PS and DVI files. 205* Document View:: Viewing PDF, PS and DVI files.
207* Gnus:: How to read netnews with Emacs. 206* Gnus:: A flexible mail and news reader.
208* Shell:: Executing shell commands from Emacs. 207* Shell:: Executing shell commands from Emacs.
209* Emacs Server:: Using Emacs as an editing server for @code{mail}, etc. 208* Emacs Server:: Using Emacs as an editing server.
210* Printing:: Printing hardcopies of buffers or regions. 209* Printing:: Printing hardcopies of buffers or regions.
211* Sorting:: Sorting lines, paragraphs or pages within Emacs. 210* Sorting:: Sorting lines, paragraphs or pages within Emacs.
212* Narrowing:: Restricting display and editing to a portion 211* Narrowing:: Restricting display and editing to a portion
@@ -331,6 +330,12 @@ Yanking
331* Appending Kills:: Several kills in a row all yank together. 330* Appending Kills:: Several kills in a row all yank together.
332* Earlier Kills:: Yanking something killed some time ago. 331* Earlier Kills:: Yanking something killed some time ago.
333 332
333Killing and Yanking on Graphical Displays
334
335* Clipboard:: How Emacs interacts with the system clipboard.
336* Primary Selection:: The temporarily selected text selection.
337* Secondary Selection:: Cutting without altering point and mark.
338
334Registers 339Registers
335 340
336* RegPos:: Saving positions in registers. 341* RegPos:: Saving positions in registers.
@@ -495,7 +500,8 @@ Multiple Windows
495 500
496Frames and Graphical Displays 501Frames and Graphical Displays
497 502
498* Cut and Paste:: Mouse commands for cut and paste. 503* Mouse Commands:: Moving, cutting, and pasting, with the mouse.
504* Word and Line Mouse:: Mouse commands for selecting whole words or lines.
499* Mouse References:: Using the mouse to select an item from a list. 505* Mouse References:: Using the mouse to select an item from a list.
500* Menu Mouse Clicks:: Mouse clicks that bring up menus. 506* Menu Mouse Clicks:: Mouse clicks that bring up menus.
501* Mode Line Mouse:: Mouse clicks on the mode line. 507* Mode Line Mouse:: Mouse clicks on the mode line.
@@ -517,14 +523,6 @@ Frames and Graphical Displays
517* Non-Window Terminals:: Multiple frames on terminals that show only one. 523* Non-Window Terminals:: Multiple frames on terminals that show only one.
518* Text-Only Mouse:: Using the mouse in text-only terminals. 524* Text-Only Mouse:: Using the mouse in text-only terminals.
519 525
520Killing and Yanking on Graphical Displays
521
522* Mouse Commands:: Moving, cutting, and pasting, with the mouse.
523* Word and Line Mouse:: Mouse commands for selecting whole words or lines.
524* Cut/Paste Other App:: Transfering text between Emacs and other apps.
525* Secondary Selection:: Cutting without altering point and mark.
526* Clipboard:: Using the clipboard for selections.
527
528International Character Set Support 526International Character Set Support
529 527
530* International Chars:: Basic concepts of multibyte characters. 528* International Chars:: Basic concepts of multibyte characters.
@@ -551,9 +549,12 @@ International Character Set Support
551 to use without multibyte characters. 549 to use without multibyte characters.
552* Charsets:: How Emacs groups its internal character codes. 550* Charsets:: How Emacs groups its internal character codes.
553 551
554Major Modes 552Modes
555 553
556* Choosing Modes:: How major modes are specified or chosen. 554* Major Modes:: Text mode vs. Lisp mode vs. C mode...
555* Minor Modes:: Each minor mode is a feature you can turn on
556 independently of any others.
557* Choosing Modes:: How modes are chosen when visiting files.
557 558
558Indentation 559Indentation
559 560
@@ -585,8 +586,6 @@ Filling Text
585* Fill Prefix:: Filling paragraphs that are indented 586* Fill Prefix:: Filling paragraphs that are indented
586 or in a comment, etc. 587 or in a comment, etc.
587* Adaptive Fill:: How Emacs can determine the fill prefix automatically. 588* Adaptive Fill:: How Emacs can determine the fill prefix automatically.
588* Refill:: Keeping paragraphs filled.
589* Longlines:: Editing text with very long lines.
590 589
591Outline Mode 590Outline Mode
592 591
@@ -1062,16 +1061,12 @@ Hyperlinking and Navigation Features
1062 1061
1063Customization 1062Customization
1064 1063
1065* Minor Modes:: Each minor mode is a feature you can turn on
1066 independently of any others.
1067* Easy Customization:: Convenient way to browse and change settings. 1064* Easy Customization:: Convenient way to browse and change settings.
1068* Variables:: Many Emacs commands examine Emacs variables 1065* Variables:: Many Emacs commands examine Emacs variables
1069 to decide what to do; by setting variables, 1066 to decide what to do; by setting variables,
1070 you can control their functioning. 1067 you can control their functioning.
1071* Key Bindings:: The keymaps say what command each key runs. 1068* Key Bindings:: Keymaps say what command each key runs.
1072 By changing them, you can "redefine keys". 1069 By changing them, you can ``redefine'' keys.
1073* Syntax:: The syntax table controls how words and
1074 expressions are parsed.
1075* Init File:: How to write common customizations in the 1070* Init File:: How to write common customizations in the
1076 @file{.emacs} file. 1071 @file{.emacs} file.
1077 1072
@@ -1491,7 +1486,7 @@ Lisp programming.
1491@include windows.texi 1486@include windows.texi
1492@include frames.texi 1487@include frames.texi
1493@include mule.texi 1488@include mule.texi
1494@include major.texi 1489@include modes.texi
1495@include indent.texi 1490@include indent.texi
1496@include text.texi 1491@include text.texi
1497@c Includes fortran-xtra. 1492@c Includes fortran-xtra.
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 633b65251e4..0fc4dfa427d 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -33,7 +33,8 @@ so that you can use many of the features described in this chapter.
33@end ifnottex 33@end ifnottex
34 34
35@menu 35@menu
36* Cut and Paste:: Mouse commands for cut and paste. 36* Mouse Commands:: Moving, cutting, and pasting, with the mouse.
37* Word and Line Mouse:: Mouse commands for selecting whole words or lines.
37* Mouse References:: Using the mouse to select an item from a list. 38* Mouse References:: Using the mouse to select an item from a list.
38* Menu Mouse Clicks:: Mouse clicks that bring up menus. 39* Menu Mouse Clicks:: Mouse clicks that bring up menus.
39* Mode Line Mouse:: Mouse clicks on the mode line. 40* Mode Line Mouse:: Mouse clicks on the mode line.
@@ -56,22 +57,8 @@ so that you can use many of the features described in this chapter.
56* Text-Only Mouse:: Using the mouse in text-only terminals. 57* Text-Only Mouse:: Using the mouse in text-only terminals.
57@end menu 58@end menu
58 59
59@node Cut and Paste
60@section Cutting and Pasting on Graphical Displays
61
62 This section describes commands for selecting a region, cutting, and
63pasting using the mouse.
64
65@menu
66* Mouse Commands:: Moving, cutting, and pasting, with the mouse.
67* Word and Line Mouse:: Mouse commands for selecting whole words or lines.
68* Cut/Paste Other App:: Transfering text between Emacs and other apps.
69* Secondary Selection:: Cutting without altering point and mark.
70* Clipboard:: Using the clipboard for selections.
71@end menu
72
73@node Mouse Commands 60@node Mouse Commands
74@subsection Mouse Commands for Editing 61@section Mouse Commands for Editing
75@cindex mouse buttons (what they do) 62@cindex mouse buttons (what they do)
76 63
77@kindex Mouse-1 64@kindex Mouse-1
@@ -141,7 +128,7 @@ variable @code{mouse-yank-at-point} to a non-@code{nil} value,
141@kbd{Mouse-2} does not move point. Then it does not matter where you 128@kbd{Mouse-2} does not move point. Then it does not matter where you
142click, or even which of the frame's windows you click on; the yank 129click, or even which of the frame's windows you click on; the yank
143occurs at the existing point. This variable also affects yanking the 130occurs at the existing point. This variable also affects yanking the
144primary and secondary selections (@pxref{Cut/Paste Other App}). 131primary and secondary selections (@pxref{Primary Selection}).
145 132
146@findex mouse-save-then-kill 133@findex mouse-save-then-kill
147 Clicking with the right mouse button, @kbd{Mouse-3}, runs the 134 Clicking with the right mouse button, @kbd{Mouse-3}, runs the
@@ -195,7 +182,7 @@ make Emacs behave this way by enabling Delete Selection mode.
195@xref{Using Region}. 182@xref{Using Region}.
196 183
197@node Word and Line Mouse 184@node Word and Line Mouse
198@subsection Mouse Commands for Words and Lines 185@section Mouse Commands for Words and Lines
199 186
200 These variants of @kbd{Mouse-1} select entire words or lines at a 187 These variants of @kbd{Mouse-1} select entire words or lines at a
201time. Emacs activates the region around the selected text, which is 188time. Emacs activates the region around the selected text, which is
@@ -224,164 +211,6 @@ Select the line you click on.
224Select the text you drag across, in the form of whole lines. 211Select the text you drag across, in the form of whole lines.
225@end table 212@end table
226 213
227@node Cut/Paste Other App
228@subsection Cut and Paste with Other Window Applications
229
230@cindex X cutting and pasting
231@cindex X selection
232@cindex primary selection
233@cindex selection, primary
234 When running Emacs under the X window system, you can easily
235transfer text between Emacs and other X applications using the
236@dfn{primary selection} (also called the @dfn{X selection}). This is
237@emph{not} the same thing as the @dfn{clipboard}, which is a separate
238facility used on desktop environments such as Gnome, and on operating
239systems such as Microsoft Windows (@pxref{Clipboard}).
240
241 Under X, whenever you select some text in Emacs by dragging or
242clicking the mouse (@pxref{Mouse Commands}), it is also saved in the
243primary selection. You can then @dfn{paste} that text into any other
244X application, usually by clicking @kbd{Mouse-2} in that application.
245Unlike the Emacs kill ring (@pxref{Kill Ring}), the primary selection
246has no ``memory'': each time you save something in the primary
247selection, either in Emacs or in another X application, the previous
248contents of the primary selection are lost.
249
250@cindex MS-Windows, and primary selection
251 MS-Windows provides no primary selection, but Emacs emulates it
252within a single Emacs session, by storing the selected text
253internally. Therefore, all the features and commands related to the
254primary selection work on Windows as they do on X, for cutting and
255pasting within the same session, but not across Emacs sessions or with
256other applications.
257
258 Whenever you kill some text using a command such as @kbd{C-w}
259(@code{kill-region}), or copy it into the kill ring using a command
260such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in
261the primary selection. @xref{Killing}.
262
263@vindex select-active-regions
264 If you set the region using the keyboard---for instance, by typing
265@kbd{C-@key{SPC}} and moving point away from the mark---the text in
266the region is not normally saved to the primary selection. However,
267if you change the variable @code{select-active-regions} to @code{t},
268the region is saved to the primary selection whenever you activate the
269mark. Each change to the region also updates the primary selection.
270
271@vindex yank-pop-change-selection
272 If you change @code{yank-pop-change-selection} to @code{t}, rotating
273the kill ring with @kbd{M-y} (@code{yank-pop}) also saves the new yank
274to the primary selection (@pxref{Yanking}).
275
276@vindex save-interprogram-paste-before-kill
277 If you change @code{save-interprogram-paste-before-kill} to
278@code{t}, each kill command first saves the existing selection onto
279the kill ring. This prevents you from losing the existing selection,
280at the risk of large memory consumption if other applications generate
281large selections.
282
283 You can yank the primary selection into Emacs using the usual yank
284commands, such as @kbd{C-y} (@code{yank}) and @kbd{Mouse-2}
285(@code{mouse-yank-at-click}). These commands actually check the
286primary selection before referring to the kill ring; if no primary
287selection is available, the kill ring contents are used. To prevent
288yank commands from accessing the primary selection, set the variable
289@code{x-select-enable-primary} to @code{nil}.
290
291 The standard coding system for the primary selection is
292@code{compound-text-with-extensions}. You may find that the pasted
293text is not what you expected. In such a case, you can specify
294another coding system for the selection by typing @kbd{C-x @key{RET}
295x} or @kbd{C-x @key{RET} X}. Alternatively, you can request a
296different data type by modifying the variable
297@code{x-select-request-type}. @xref{Communication Coding}.
298
299@node Secondary Selection
300@subsection Secondary Selection
301@cindex secondary selection
302
303 In addition to the primary selection, the X Window System provides a
304second similar facility known as the @dfn{secondary selection}.
305Nowadays, few X applications make use of the secondary selection, but
306you can access it using the following Emacs commands:
307
308@table @kbd
309@findex mouse-set-secondary
310@kindex M-Drag-Mouse-1
311@item M-Drag-Mouse-1
312Set the secondary selection, with one end at the place where you press
313down the button, and the other end at the place where you release it
314(@code{mouse-set-secondary}). The selected text is highlighted, using
315the @code{secondary-selection} face, as you drag. The window scrolls
316automatically if you drag the mouse off the top or bottom of the
317window, just like @code{mouse-set-region} (@pxref{Mouse Commands}).
318
319This command does not alter the kill ring.
320
321@findex mouse-start-secondary
322@kindex M-Mouse-1
323@item M-Mouse-1
324Set one endpoint for the @dfn{secondary selection}
325(@code{mouse-start-secondary}).
326
327@findex mouse-secondary-save-then-kill
328@kindex M-Mouse-3
329@item M-Mouse-3
330Set the secondary selection, with one end at the position clicked and
331the other at the position specified with @kbd{M-Mouse-1}
332(@code{mouse-secondary-save-then-kill}). This also puts the selected
333text in the kill ring. A second @kbd{M-Mouse-3} at the same place
334kills the secondary selection just made.
335
336@findex mouse-yank-secondary
337@kindex M-Mouse-2
338@item M-Mouse-2
339Insert the secondary selection where you click, placing point at the
340end of the yanked text (@code{mouse-yank-secondary}).
341@end table
342
343Double or triple clicking of @kbd{M-Mouse-1} operates on words and
344lines, much like @kbd{Mouse-1}.
345
346If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-Mouse-2} yanks
347at point. Then it does not matter precisely where you click, or even
348which of the frame's windows you click on. @xref{Mouse Commands}.
349
350@node Clipboard
351@subsection Using the Clipboard
352@cindex clipboard
353
354 In desktop environments such as Gnome, and operating systems such as
355Microsoft Windows and Mac OS X, you can transfer data (usually text)
356between different applications using the @dfn{clipboard}. The
357clipboard is distinct from the primary selection and secondary
358selection discussed earlier. You can access the clipboard through the
359@samp{Edit} menu of the menu bar (@pxref{Menu Bar}).
360
361@cindex cut
362@findex clipboard-kill-region
363 The command @code{clipboard-kill-region}, which is bound to the
364@code{Cut} menu item, kills the region and saves it in the clipboard.
365
366@cindex copy
367@findex clipboard-kill-ring-save
368 The command @code{clipboard-kill-ring-save}, which is bound to the
369@code{Copy} menu item, copies the region to the kill ring and saves it
370in the clipboard.
371
372@findex clipboard-yank
373@cindex paste
374 The @code{Paste} menu item in the Edit menu yanks the contents of
375the clipboard at point (@code{clipboard-yank}).
376
377@vindex x-select-enable-clipboard
378 You can customize the variable @code{x-select-enable-clipboard} to
379make the Emacs yank functions consult the clipboard before the primary
380selection, and to make the kill functions to store in the clipboard as
381well as the primary selection. Otherwise, these commands do not
382access the clipboard at all. Using the clipboard is the default on
383MS-Windows and Mac OS, but not on other systems.
384
385@node Mouse References 214@node Mouse References
386@section Following References with the Mouse 215@section Following References with the Mouse
387@kindex Mouse-1 @r{(selection)} 216@kindex Mouse-1 @r{(selection)}
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 3cf1cc522bf..e37e80bfab8 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -962,7 +962,7 @@ special Emacs commands for moving over and operating on paragraphs.
962@item Parsing 962@item Parsing
963We say that certain Emacs commands parse words or expressions in the 963We say that certain Emacs commands parse words or expressions in the
964text being edited. Really, all they know how to do is find the other 964text being edited. Really, all they know how to do is find the other
965end of a word or expression. @xref{Syntax}. 965end of a word or expression.
966 966
967@item Point 967@item Point
968Point is the place in the buffer at which insertion and deletion 968Point is the place in the buffer at which insertion and deletion
@@ -1212,7 +1212,8 @@ See `font lock.'
1212@item Syntax Table 1212@item Syntax Table
1213The syntax table tells Emacs which characters are part of a word, 1213The syntax table tells Emacs which characters are part of a word,
1214which characters balance each other like parentheses, etc. 1214which characters balance each other like parentheses, etc.
1215@xref{Syntax}. 1215@xref{Syntax Tables,, Syntax Tables, elisp, The Emacs Lisp Reference
1216Manual}.
1216 1217
1217@item Super 1218@item Super
1218Super is the name of a modifier bit that a keyboard input character may 1219Super is the name of a modifier bit that a keyboard input character may
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index e00f8b9115a..76a9f2413b1 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -139,8 +139,11 @@ command.
139@item C-h r 139@item C-h r
140Display the Emacs manual in Info (@code{info-emacs-manual}). 140Display the Emacs manual in Info (@code{info-emacs-manual}).
141@item C-h s 141@item C-h s
142Display the current contents of the syntax table, with an explanation of 142Display the current contents of the @dfn{syntax table}, with an
143what they mean (@code{describe-syntax}). @xref{Syntax}. 143explanation of what they mean (@code{describe-syntax}). The syntax
144table says which characters are opening delimiters, which are parts of
145words, which are string quotes, and so on. @xref{Syntax Tables,,
146Syntax Tables, elisp, The Emacs Lisp Reference Manual}, for details.
144@item C-h t 147@item C-h t
145Enter the Emacs interactive tutorial (@code{help-with-tutorial}). 148Enter the Emacs interactive tutorial (@code{help-with-tutorial}).
146@item C-h v @var{var} @key{RET} 149@item C-h v @var{var} @key{RET}
@@ -583,7 +586,8 @@ bindings now in effect: first the local bindings of the current minor
583modes, then the local bindings defined by the current major mode, and 586modes, then the local bindings defined by the current major mode, and
584finally the global bindings (@pxref{Key Bindings}). @kbd{C-h s} 587finally the global bindings (@pxref{Key Bindings}). @kbd{C-h s}
585displays the contents of the syntax table, with explanations of each 588displays the contents of the syntax table, with explanations of each
586character's syntax (@pxref{Syntax}). 589character's syntax (@pxref{Syntax Tables,, Syntax Tables, elisp, The
590Emacs Lisp Reference Manual}).
587 591
588 You can get a list of subcommands for a particular prefix key by 592 You can get a list of subcommands for a particular prefix key by
589typing @kbd{C-h} after the prefix key. (There are a few prefix keys 593typing @kbd{C-h} after the prefix key. (There are a few prefix keys
diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi
index c4ef4781aaf..e13b2808f09 100644
--- a/doc/emacs/indent.texi
+++ b/doc/emacs/indent.texi
@@ -2,7 +2,7 @@
2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2011 2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2011
3@c Free Software Foundation, Inc. 3@c Free Software Foundation, Inc.
4@c See file emacs.texi for copying conditions. 4@c See file emacs.texi for copying conditions.
5@node Indentation, Text, Major Modes, Top 5@node Indentation, Text, Modes, Top
6@chapter Indentation 6@chapter Indentation
7@cindex indentation 7@cindex indentation
8@cindex tabs 8@cindex tabs
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 41262e9c2d8..38124fc315a 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -6,20 +6,24 @@
6@node Killing, Registers, Mark, Top 6@node Killing, Registers, Mark, Top
7@chapter Killing and Moving Text 7@chapter Killing and Moving Text
8 8
9 @dfn{Killing} means erasing text and copying it into the @dfn{kill 9 In Emacs, @dfn{killing} means erasing text and copying it into the
10ring}, from which you can bring it back into the buffer by 10@dfn{kill ring}. @dfn{Yanking} means bringing text from the kill ring
11@dfn{yanking} it. (Some applications use the terms ``cutting'' and 11back into the buffer. (Some applications use the terms ``cutting''
12``pasting'' for similar operations.) This is the most common way of 12and ``pasting'' for similar operations.) The kill ring is so-named
13moving or copying text within Emacs. It is very versatile, because 13because it can be visualized as a set of blocks of text arranged in a
14there are commands for killing many different types of syntactic 14ring, which you can access in cyclic order. @xref{Kill Ring}.
15units. 15
16 Killing and yanking are the most common way to move or copy text
17within Emacs. It is very versatile, because there are commands for
18killing many different types of syntactic units.
16 19
17@menu 20@menu
18* Deletion and Killing:: Commands that remove text. 21* Deletion and Killing:: Commands that remove text.
19* Yanking:: Commands that insert text. 22* Yanking:: Commands that insert text.
23* Cut and Paste:: Clipboard and selections on graphical displays.
20* Accumulating Text:: Other methods to add text to the buffer. 24* Accumulating Text:: Other methods to add text to the buffer.
21* Rectangles:: Operating on text in rectangular areas. 25* Rectangles:: Operating on text in rectangular areas.
22* CUA Bindings:: Using C-x/C-c/C-v to kill and yank. 26* CUA Bindings:: Using @kbd{C-x}/@kbd{C-c}/@kbd{C-v} to kill and yank.
23@end menu 27@end menu
24 28
25@node Deletion and Killing 29@node Deletion and Killing
@@ -29,25 +33,28 @@ units.
29@cindex cutting text 33@cindex cutting text
30@cindex deletion 34@cindex deletion
31 Most commands which erase text from the buffer save it in the kill 35 Most commands which erase text from the buffer save it in the kill
32ring. These are known as @dfn{kill} commands. The kill ring stores 36ring. These are known as @dfn{kill} commands, and their names
33several recent kills, not just the last one, so killing is a very safe 37normally contain the word @samp{kill} (e.g. @code{kill-line}). The
34operation: when you make a new kill, you don't have to worry much 38kill ring stores several recent kills, not just the last one, so
35about losing text that you previously killed. 39killing is a very safe operation: you don't have to worry much about
40losing text that you previously killed. The kill ring is shared by
41all buffers, so text that is killed in one buffer can be yanked into
42another buffer.
43
44 When you use @kbd{C-/} (@code{undo}) to undo a kill command
45(@pxref{Undo}), that brings the killed text back into the buffer, but
46does not remove it from the kill ring.
36 47
37 You can yank text from the kill ring into any position in a buffer, 48 On graphical displays, killing text also copies it to the system
38including a position in a different buffer; the kill ring is shared by 49clipboard. @xref{Cut and Paste}.
39all buffers. The @kbd{C-/} (@code{undo}) command can undo both kill
40and delete commands (@pxref{Undo}); the importance of the kill ring is
41that you can yank the text in a different place.
42 50
43 Commands that erase text but do not save it in the kill ring are 51 Commands that erase text but do not save it in the kill ring are
44known as @dfn{delete} commands. These include @kbd{C-d} 52known as @dfn{delete} commands; their names usually contain the word
45(@code{delete-char}) and @key{DEL} (@code{delete-backward-char}), 53@samp{delete}. These include @kbd{C-d} (@code{delete-char}) and
46which delete only one character at a time, and those commands that 54@key{DEL} (@code{delete-backward-char}), which delete only one
47delete only spaces or newlines. Commands that can erase significant 55character at a time, and those commands that delete only spaces or
48amounts of nontrivial data generally do a kill operation instead. The 56newlines. Commands that can erase significant amounts of nontrivial
49commands' names and individual descriptions use the words @samp{kill} 57data generally do a kill operation instead.
50and @samp{delete} to say which kind of operation they perform.
51 58
52 You can also use the mouse to kill and yank. @xref{Cut and Paste}. 59 You can also use the mouse to kill and yank. @xref{Cut and Paste}.
53 60
@@ -127,21 +134,22 @@ Kill an entire line at once (@code{kill-whole-line})
127 134
128@kindex C-k 135@kindex C-k
129@findex kill-line 136@findex kill-line
130 The simplest kill command is @kbd{C-k}. If given at the beginning 137 The simplest kill command is @kbd{C-k} (@code{kill-line}). If used
131of a line, it kills all the text on the line@footnote{Here, ``line'' 138at the end of a line, it kills the line-ending newline character,
132means a logical text line, not a screen line. @xref{Continuation 139merging the next line into the current one (thus, a blank line is
133Lines}.}, leaving it blank. When used on a blank line, it kills the 140entirely removed). Otherwise, @kbd{C-k} kills all the text from point
134whole line including its newline. 141up to the end of the line; if point was originally at the beginning of
135 142the line, this leaves the line blank.
136 More precisely, @kbd{C-k} kills from point up to the end of the 143
137line, unless it is at the end of a line. In that case it kills the 144 Spaces and tabs at the end of the line are ignored when deciding
138newline following point, thus merging the next line into the current 145which case applies. As long as point is after the last visible
139one. Spaces and tabs at the end of the line are ignored when deciding
140which case applies, so as long as point is after the last visible
141character in the line, you can be sure that @kbd{C-k} will kill the 146character in the line, you can be sure that @kbd{C-k} will kill the
142newline. To kill an entire non-blank line, go to the beginning and 147newline. To kill an entire non-blank line, go to the beginning and
143type @kbd{C-k} twice. 148type @kbd{C-k} twice.
144 149
150 In this context, ``line'' means a logical text line, not a screen
151line (@pxref{Continuation Lines}).
152
145 When @kbd{C-k} is given a positive argument @var{n}, it kills 153 When @kbd{C-k} is given a positive argument @var{n}, it kills
146@var{n} lines and the newlines that follow them (text on the current 154@var{n} lines and the newlines that follow them (text on the current
147line before point is not killed). With a negative argument 155line before point is not killed). With a negative argument
@@ -157,10 +165,10 @@ following newline. This variable is normally @code{nil}.
157 165
158@kindex C-S-backspace 166@kindex C-S-backspace
159@findex kill-whole-line 167@findex kill-whole-line
160 @kbd{C-S-backspace} (@code{kill-whole-line}) will kill a whole line 168 @kbd{C-S-backspace} (@code{kill-whole-line}) kills a whole line
161including its newline regardless of the position of point within the 169including its newline, regardless of the position of point within the
162line. Note that many character terminals will prevent you from typing 170line. Note that many text terminals will prevent you from typing the
163the key sequence @kbd{C-S-backspace}. 171key sequence @kbd{C-S-backspace}.
164 172
165@node Other Kill Commands 173@node Other Kill Commands
166@subsection Other Kill Commands 174@subsection Other Kill Commands
@@ -196,10 +204,8 @@ last set. The mark is deactivated at the end of the command.
196 204
197@kindex M-w 205@kindex M-w
198@findex kill-ring-save 206@findex kill-ring-save
199 The command @kbd{M-w} (@code{kill-ring-save}) copies the region into 207 @kbd{M-w} (@code{kill-ring-save}) copies the region into the kill
200the kill ring without removing it from the buffer. This is 208ring without removing it from the buffer.
201approximately equivalent to @kbd{C-w} followed by @kbd{C-/}, except
202that @kbd{M-w} does not alter the undo history.
203 209
204 Emacs also provides commands to kill specific syntactic units: 210 Emacs also provides commands to kill specific syntactic units:
205words, with @kbd{M-@key{DEL}} and @kbd{M-d} (@pxref{Words}); balanced 211words, with @kbd{M-@key{DEL}} and @kbd{M-d} (@pxref{Words}); balanced
@@ -220,12 +226,10 @@ search backward and kill text before point.
220@vindex kill-read-only-ok 226@vindex kill-read-only-ok
221@cindex read-only text, killing 227@cindex read-only text, killing
222 Some specialized buffers contain @dfn{read-only text}, which cannot 228 Some specialized buffers contain @dfn{read-only text}, which cannot
223be modified and therefore cannot be killed. But some users like to 229be modified and therefore cannot be killed. The kill commands work
224use the kill commands to copy read-only text into the kill ring, 230specially in a read-only buffer: they move over text and copy it to
225without actually changing it. Therefore, the kill commands work
226specially in a read-only buffer: they move over text, and copy it to
227the kill ring, without actually deleting it from the buffer. 231the kill ring, without actually deleting it from the buffer.
228Normally, kill commands beep and display an error message when this 232Normally, they also beep and display an error message when this
229happens. But if you set the variable @code{kill-read-only-ok} to a 233happens. But if you set the variable @code{kill-read-only-ok} to a
230non-@code{nil} value, they just print a message in the echo area to 234non-@code{nil} value, they just print a message in the echo area to
231explain why the text has not been erased. 235explain why the text has not been erased.
@@ -257,10 +261,16 @@ Replace text just yanked with an earlier batch of killed text
257Append next kill to last batch of killed text (@code{append-next-kill}). 261Append next kill to last batch of killed text (@code{append-next-kill}).
258@end table 262@end table
259 263
260 On graphical displays with window systems, if there is a current 264@cindex yanking and text properties
261selection in some other application, and you selected it more recently 265@vindex yank-excluded-properties
262than you killed any text in Emacs, @kbd{C-y} copies the selection 266 The yank commands discard certain properties from the yanked text.
263instead of text killed within Emacs. 267These are properties that might lead to annoying results, such as
268causing the text to respond to the mouse or specifying key bindings.
269The list of properties to discard is stored in the variable
270@code{yank-excluded-properties}. These properties are also discarded
271when yanking register contents and rectangles. @xref{Text
272Properties,,, elisp, the Emacs Lisp Reference Manual}, for more
273information about text properties.
264 274
265@menu 275@menu
266* Kill Ring:: Where killed text is stored. Basic yanking. 276* Kill Ring:: Where killed text is stored. Basic yanking.
@@ -271,38 +281,34 @@ instead of text killed within Emacs.
271@node Kill Ring 281@node Kill Ring
272@subsection The Kill Ring 282@subsection The Kill Ring
273 283
274 All killed text is recorded in the @dfn{kill ring}, a list of blocks 284 The @dfn{kill ring} is a list of blocks of text that were previously
275of text that have been killed. There is only one kill ring, shared by 285killed. There is only one kill ring, shared by all buffers, so you
276all buffers, so you can kill text in one buffer and yank it in another 286can kill text in one buffer and yank it in another buffer. This is
277buffer. This is the usual way to move text from one file to another. 287the usual way to move text from one file to another. (There are
278(There are several other methods: for instance, you could store the 288several other methods: for instance, you could store the text in a
279text in a register. @xref{Registers}, for information about 289register; see @ref{Registers}. @xref{Accumulating Text}, for some
280registers. @xref{Accumulating Text}, for some other ways to move text 290other ways to move text around.)
281around.)
282 291
283@kindex C-y 292@kindex C-y
284@findex yank 293@findex yank
285 The command @kbd{C-y} (@code{yank}) reinserts the text of the most 294 @kbd{C-y} (@code{yank}) reinserts the text of the most recent kill,
286recent kill, leaving the cursor at the end of the text. It also adds 295leaving the cursor at the end of the text. It also adds the position
287the position of the beginning of the text to the mark ring, without 296of the beginning of the text to the mark ring, without activating the
288activating the mark; this allows you to jump easily to that position 297mark; this allows you to jump easily to that position with @kbd{C-x
289with @kbd{C-x C-x} (@pxref{Setting Mark}). With a plain prefix 298C-x} (@pxref{Setting Mark}).
290argument (@kbd{C-u C-y}), it instead leaves the cursor in front of the 299
291text, and adds the position of the end of the text to the mark ring. 300 On graphical displays, @kbd{C-y} first checks if another application
292Using other sort of prefix argument specifies an earlier kill; for 301has placed any text in the system clipboard more recently than the
293example, @kbd{C-u 4 C-y} reinserts the fourth most recent kill. 302last Emacs kill. If so, it inserts from the clipboard instead of the
294@xref{Earlier Kills}. 303kill ring. Conceptually, you can think of the clipboard as an
295 304``extra'' entry in the kill ring, which is present if you recently cut
296@cindex yanking and text properties 305or copied some text in another application. @xref{Cut and Paste}.
297@vindex yank-excluded-properties 306
298 The yank commands discard certain properties from the yanked text. 307 With a plain prefix argument (@kbd{C-u C-y}), the @code{yank}
299These are properties that might lead to annoying results, such as 308command instead leaves the cursor in front of the text, and adds the
300causing the text to respond to the mouse or specifying key bindings. 309position of the end of the text to the mark ring. Using any other
301The list of properties to discard is stored in the variable 310prefix argument specifies an earlier kill; for example, @kbd{C-u 4
302@code{yank-excluded-properties}. Yanking of register contents and 311C-y} reinserts the fourth most recent kill. @xref{Earlier Kills}.
303rectangles also discard these properties. @xref{Text Properties,,,
304elisp, the Emacs Lisp Reference Manual}, for more information about
305text properties.
306 312
307@node Appending Kills 313@node Appending Kills
308@subsection Appending Kills 314@subsection Appending Kills
@@ -418,6 +424,177 @@ saved.
418@code{kill-ring}; you can view the entire contents of the kill ring with 424@code{kill-ring}; you can view the entire contents of the kill ring with
419the command @kbd{C-h v kill-ring}. 425the command @kbd{C-h v kill-ring}.
420 426
427@node Cut and Paste
428@section ``Cut and Paste'' Operations on Graphical Displays
429@cindex cut
430@cindex copy
431@cindex paste
432
433 In most graphical desktop environments, you can transfer data
434(usually text) between different applications using a system facility
435called the @dfn{clipboard}. On X, two other similar facilities are
436available: the primary selection and the secondary selection. When
437Emacs is run on a graphical display, its kill and yank commands
438integrate with these facilities, so that you can easily transfer text
439between Emacs and other graphical applications.
440
441 By default, Emacs uses UTF-8 as the coding system for inter-program
442text transfers. If you find that the pasted text is not what you
443expected, you can specify another coding system by typing @kbd{C-x
444@key{RET} x} or @kbd{C-x @key{RET} X}. You can also request a
445different data type by customizing @code{x-select-request-type}.
446@xref{Communication Coding}.
447
448@menu
449* Clipboard:: How Emacs uses the system clipboard.
450* Primary Selection:: The temporarily selected text selection.
451* Secondary Selection:: Cutting without altering point and mark.
452@end menu
453
454@node Clipboard
455@subsection Using the Clipboard
456@cindex clipboard
457
458 The @dfn{clipboard} is the facility that most graphical applications
459use for ``cutting and pasting''. When the clipboard exists, the kill
460and yank commands in Emacs make use of it.
461
462 When you kill some text with a command such as @kbd{C-w}
463(@code{kill-region}), or copy it to the kill ring with a command such
464as @kbd{M-w} (@code{kill-ring-save}), that text is also put in the
465clipboard. @xref{Killing}.
466
467@vindex save-interprogram-paste-before-kill
468 When an Emacs kill command puts text in the clipboard, the existing
469clipboard contents are normally lost. Optionally, you can change
470@code{save-interprogram-paste-before-kill} to @code{t}. Then Emacs
471will first save the clipboard to its kill ring, preventing you from
472losing the old clipboard data---at the risk of high memory consumption
473if that data turns out to be large.
474
475 The usual yank commands, such as @kbd{C-y} (@code{yank}), also use
476the clipboard. If another application ``owns'' the clipboard---i.e.,
477if you cut or copied text there more recently than your last kill
478command in Emacs---then Emacs yanks from the clipboard instead of the
479kill ring. Otherwise, it yanks from the kill ring, as described in
480@ref{Yanking}.
481
482@vindex yank-pop-change-selection
483 Normally, rotating the kill ring with @kbd{M-y} (@code{yank-pop})
484does not alter the clipboard. However, if you change
485@code{yank-pop-change-selection} to @code{t}, then @kbd{M-y} saves the
486new yank to the clipboard.
487
488@vindex x-select-enable-clipboard
489 To prevent kill and yank commands from accessing the clipboard,
490change the variable @code{x-select-enable-clipboard} to @code{nil}.
491
492@vindex x-select-enable-primary
493@findex clipboard-kill-region
494@findex clipboard-kill-ring-save
495@findex clipboard-yank
496 Prior to Emacs 24, the kill and yank commands used the primary
497selection (@pxref{Primary Selection}), not the clipboard. If you
498prefer this behavior, change @code{x-select-enable-clipboard} to
499@code{nil}, @code{x-select-enable-primary} to @code{t}, and
500@code{mouse-drag-copy-region} to @code{t}. In this case, you can use
501the following commands to act explicitly on the clipboard:
502@code{clipboard-kill-region} kills the region and saves it to the
503clipboard; @code{clipboard-kill-ring-save} copies the region to the
504kill ring and saves it to the clipboard; and @code{clipboard-yank}
505yanks the contents of the clipboard at point.
506
507@node Primary Selection
508@subsection Cut and Paste with Other Window Applications
509@cindex X cutting and pasting
510@cindex X selection
511@cindex primary selection
512@cindex selection, primary
513
514 Under the X window system, there exists a @dfn{primary selection}
515containing the last stretch of text selected in an X application
516(usually by dragging the mouse). Typically, this text can be inserted
517into other X applications by @kbd{mouse-2} clicks. The primary
518selection is separate from the clipboard (@pxref{Clipboard}). Its
519contents are more ``fragile''; they are overwritten by any mouse
520selection, whereas the clipboard is only overwritten by explicit
521``cut'' or ``copy'' commands.
522
523 Under X, whenever you select some text in Emacs by dragging or
524clicking the mouse (@pxref{Mouse Commands}), it is also saved to the
525primary selection.
526
527@vindex select-active-regions
528 If you set the region using the keyboard---for instance, by typing
529@kbd{C-@key{SPC}} and moving point away from the mark---the text in
530the region is also saved to the primary selection. (The updating of
531the primary selection is done at the end of each command, as long as
532the region is active and non-empty.) To disable this behavior, change
533the variable @code{select-active-regions} to @code{nil}.
534
535 To insert the primary selection into an Emacs buffer, click
536@kbd{mouse-2} (@code{mouse-yank-primary}) where you want to insert it.
537@xref{Mouse Commands}.
538
539@cindex MS-Windows, and primary selection
540 MS-Windows provides no primary selection, but Emacs emulates it
541within a single Emacs session by storing the selected text internally.
542Therefore, all the features and commands related to the primary
543selection work on Windows as they do on X, for cutting and pasting
544within the same session, but not across Emacs sessions or with other
545applications.
546
547@node Secondary Selection
548@subsection Secondary Selection
549@cindex secondary selection
550
551 In addition to the primary selection, the X Window System provides a
552second similar facility known as the @dfn{secondary selection}.
553Nowadays, few X applications make use of the secondary selection, but
554you can access it using the following Emacs commands:
555
556@table @kbd
557@findex mouse-set-secondary
558@kindex M-Drag-Mouse-1
559@item M-Drag-Mouse-1
560Set the secondary selection, with one end at the place where you press
561down the button, and the other end at the place where you release it
562(@code{mouse-set-secondary}). The selected text is highlighted, using
563the @code{secondary-selection} face, as you drag. The window scrolls
564automatically if you drag the mouse off the top or bottom of the
565window, just like @code{mouse-set-region} (@pxref{Mouse Commands}).
566
567This command does not alter the kill ring.
568
569@findex mouse-start-secondary
570@kindex M-Mouse-1
571@item M-Mouse-1
572Set one endpoint for the @dfn{secondary selection}
573(@code{mouse-start-secondary}).
574
575@findex mouse-secondary-save-then-kill
576@kindex M-Mouse-3
577@item M-Mouse-3
578Set the secondary selection, with one end at the position clicked and
579the other at the position specified with @kbd{M-Mouse-1}
580(@code{mouse-secondary-save-then-kill}). This also puts the selected
581text in the kill ring. A second @kbd{M-Mouse-3} at the same place
582kills the secondary selection just made.
583
584@findex mouse-yank-secondary
585@kindex M-Mouse-2
586@item M-Mouse-2
587Insert the secondary selection where you click, placing point at the
588end of the yanked text (@code{mouse-yank-secondary}).
589@end table
590
591Double or triple clicking of @kbd{M-Mouse-1} operates on words and
592lines, much like @kbd{Mouse-1}.
593
594If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-Mouse-2} yanks
595at point. Then it does not matter precisely where you click, or even
596which of the frame's windows you click on. @xref{Mouse Commands}.
597
421@node Accumulating Text 598@node Accumulating Text
422@section Accumulating Text 599@section Accumulating Text
423@findex append-to-buffer 600@findex append-to-buffer
diff --git a/doc/emacs/major.texi b/doc/emacs/major.texi
deleted file mode 100644
index 9256c712f02..00000000000
--- a/doc/emacs/major.texi
+++ /dev/null
@@ -1,237 +0,0 @@
1@c This is part of the Emacs manual.
2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2011
3@c Free Software Foundation, Inc.
4@c See file emacs.texi for copying conditions.
5@node Major Modes, Indentation, International, Top
6@chapter Major Modes
7@cindex major modes
8@cindex mode, major
9@kindex TAB @r{(and major modes)}
10@kindex DEL @r{(and major modes)}
11@kindex C-j @r{(and major modes)}
12
13 Emacs provides many alternative @dfn{major modes}, each of which
14customizes Emacs for editing text of a particular sort. The major modes
15are mutually exclusive, and each buffer has one major mode at any time.
16The mode line normally shows the name of the current major mode, in
17parentheses (@pxref{Mode Line}).
18
19 The least specialized major mode is called @dfn{Fundamental mode}.
20This mode has no mode-specific redefinitions or variable settings, so
21that each Emacs command behaves in its most general manner, and each
22user option variable is in its default state. For editing text of a
23specific type that Emacs knows about, such as Lisp code or English
24text, you should switch to the appropriate major mode, such as Lisp
25mode or Text mode.
26
27 Selecting a major mode changes the meanings of a few keys to become
28more specifically adapted to the language being edited. The ones that
29are changed frequently are @key{TAB}, @key{DEL}, and @kbd{C-j}. The
30prefix key @kbd{C-c} normally contains mode-specific commands. In
31addition, the commands which handle comments use the mode to determine
32how comments are to be delimited. Many major modes redefine the
33syntactical properties of characters appearing in the buffer.
34@xref{Syntax}.
35
36 The major modes fall into three major groups. The first group
37contains modes for normal text, either plain or with mark-up. It
38includes Text mode, HTML mode, SGML mode, @TeX{} mode and Outline
39mode. The second group contains modes for specific programming
40languages. These include Lisp mode (which has several variants), C
41mode, Fortran mode, and others. The remaining major modes are not
42intended for use on users' files; they are used in buffers created for
43specific purposes by Emacs, such as Dired mode for buffers made by
44Dired (@pxref{Dired}), Message mode for buffers made by @kbd{C-x m}
45(@pxref{Sending Mail}), and Shell mode for buffers used for
46communicating with an inferior shell process (@pxref{Interactive
47Shell}).
48
49 Most programming-language major modes specify that only blank lines
50separate paragraphs. This is to make the paragraph commands useful.
51(@xref{Paragraphs}.) They also cause Auto Fill mode to use the
52definition of @key{TAB} to indent the new lines it creates. This is
53because most lines in a program are usually indented
54(@pxref{Indentation}).
55
56@menu
57* Choosing Modes:: How major modes are specified or chosen.
58@end menu
59
60@node Choosing Modes,,Major Modes,Major Modes
61@section How Major Modes are Chosen
62
63@cindex choosing a major mode
64 You can select a major mode explicitly for the current buffer, but
65most of the time Emacs determines which mode to use based on the file
66name or on special text in the file.
67
68 To explicitly select a new major, you use an @kbd{M-x} command.
69Take the name of a major mode and add @code{-mode} to get the name of
70the command to select that mode. Thus, you can enter Lisp mode by
71executing @kbd{M-x lisp-mode}.
72
73@vindex auto-mode-alist
74 When you visit a file, Emacs usually chooses the right major mode
75automatically. Normally, it makes the choice based on the file
76name---for example, files whose names end in @samp{.c} are normally
77edited in C mode---but sometimes it chooses the major mode based on
78the contents of the file. Here is the exact procedure:
79
80 First, Emacs checks whether the file contains a file-local variable
81that specifies the major mode. If so, it uses that major mode,
82ignoring all other criteria. @xref{File Variables}. There are
83several methods to specify a major mode using a file-local variable;
84the simplest is to put the mode name in the first nonblank line,
85preceded and followed by @samp{-*-}. Other text may appear on the
86line as well. For example,
87
88@example
89; -*-Lisp-*-
90@end example
91
92@noindent
93tells Emacs to use Lisp mode. Note how the semicolon is used to make
94Lisp treat this line as a comment. Alternatively, you could write
95
96@example
97; -*- mode: Lisp;-*-
98@end example
99
100@noindent
101The latter format allows you to specify local variables as well, like
102this:
103
104@example
105; -*- mode: Lisp; tab-width: 4; -*-
106@end example
107
108@vindex interpreter-mode-alist
109 Second, Emacs checks whether the file's contents begin with
110@samp{#!}. If so, that indicates that the file can serve as an
111executable shell command, which works by running an interpreter named
112on the file's first line (the rest of the file is used as input to the
113interpreter). Therefore, Emacs tries to use the interpreter name to
114choose a mode. For instance, a file that begins with
115@samp{#!/usr/bin/perl} is opened in Perl mode. The variable
116@code{interpreter-mode-alist} specifies the correspondence between
117interpreter program names and major modes.
118
119 When the first line starts with @samp{#!}, you usually cannot use
120the @samp{-*-} feature on the first line, because the system would get
121confused when running the interpreter. So Emacs looks for @samp{-*-}
122on the second line in such files as well as on the first line. The
123same is true for man pages which start with the magic string
124@samp{'\"} to specify a list of troff preprocessors.
125
126@vindex magic-mode-alist
127 Third, Emacs tries to determine the major mode by looking at the
128text at the start of the buffer, based on the variable
129@code{magic-mode-alist}. By default, this variable is @code{nil} (an
130empty list), so Emacs skips this step; however, you can customize it
131in your init file (@pxref{Init File}). The value should be a list of
132elements of the form
133
134@example
135(@var{regexp} . @var{mode-function})
136@end example
137
138@noindent
139where @var{regexp} is a regular expression (@pxref{Regexps}), and
140@var{mode-function} is a Lisp function that toggles a major mode. If
141the text at the beginning of the file matches @var{regexp}, Emacs
142chooses the major mode specified by @var{mode-function}.
143
144Alternatively, an element of @code{magic-mode-alist} may have the form
145
146@example
147(@var{match-function} . @var{mode-function})
148@end example
149
150@noindent
151where @var{match-function} is a Lisp function that is called at the
152beginning of the buffer; if the function returns non-@code{nil}, Emacs
153set the major mode wit @var{mode-function}.
154
155 Fourth---if Emacs still hasn't found a suitable major mode---it
156looks at the file's name. The correspondence between file names and
157major modes is controlled by the variable @code{auto-mode-alist}. Its
158value is a list in which each element has this form,
159
160@example
161(@var{regexp} . @var{mode-function})
162@end example
163
164@noindent
165or this form,
166
167@example
168(@var{regexp} @var{mode-function} @var{flag})
169@end example
170
171@noindent
172For example, one element normally found in the list has the form
173@code{(@t{"\\.c\\'"} . c-mode)}, and it is responsible for selecting C
174mode for files whose names end in @file{.c}. (Note that @samp{\\} is
175needed in Lisp syntax to include a @samp{\} in the string, which must
176be used to suppress the special meaning of @samp{.} in regexps.) If
177the element has the form @code{(@var{regexp} @var{mode-function}
178@var{flag})} and @var{flag} is non-@code{nil}, then after calling
179@var{mode-function}, Emacs discards the suffix that matched
180@var{regexp} and searches the list again for another match.
181
182@vindex auto-mode-case-fold
183 On systems with case-insensitive file names, such as Microsoft
184Windows, Emacs performs a single case-insensitive search through
185@code{auto-mode-alist}. On other systems, Emacs normally performs a
186single case-sensitive search through the alist. However, if you
187change the variable @code{auto-mode-case-fold} to @code{t}, Emacs
188performs a second case-insensitive search if the first search fails.
189
190@vindex magic-fallback-mode-alist
191 Finally, if Emacs @emph{still} hasn't found a major mode to use, it
192compares the text at the start of the buffer to the variable
193@code{magic-fallback-mode-alist}. This variable works like
194@code{magic-mode-alist}, described above, except that is consulted
195only after @code{auto-mode-alist}. By default,
196@code{magic-fallback-mode-alist} contains forms that check for image
197files, HTML/XML/SGML files, and Postscript files.
198
199@vindex major-mode
200 Once a major mode is chosen, Emacs sets the value of the variable
201@code{major-mode} to the symbol for that major mode (e.g.,
202@code{text-mode} for Text mode). This is a per-buffer variable
203(@pxref{Locals}); its buffer-local value is set automatically, and you
204should not change it yourself.
205
206 The default value of @code{major-mode} determines the major mode to
207use for files that do not specify a major mode, and for new buffers
208created with @kbd{C-x b}. Normally, this default value is the symbol
209@code{fundamental-mode}, which specifies Fundamental mode. You can
210change it via the Customization interface (@pxref{Easy
211Customization}), or by adding a line like this to your init file
212(@pxref{Init File}):
213
214@smallexample
215(setq-default major-mode 'text-mode)
216@end smallexample
217
218@noindent
219If the default value of @code{major-mode} is @code{nil}, the major
220mode is taken from the previously current buffer.
221
222@findex normal-mode
223 If you have changed the major mode of a buffer, you can return to
224the major mode Emacs would have chosen automatically, by typing
225@kbd{M-x normal-mode}. This is the same function that
226@code{find-file} calls to choose the major mode. It also processes
227the file's @samp{-*-} line or local variables list (if any).
228@xref{File Variables}.
229
230@vindex change-major-mode-with-file-name
231 The commands @kbd{C-x C-w} and @code{set-visited-file-name} change to
232a new major mode if the new file name implies a mode (@pxref{Saving}).
233(@kbd{C-x C-s} does this too, if the buffer wasn't visiting a file.)
234However, this does not happen if the buffer contents specify a major
235mode, and certain ``special'' major modes do not allow the mode to
236change. You can turn off this mode-changing feature by setting
237@code{change-major-mode-with-file-name} to @code{nil}.
diff --git a/doc/emacs/makefile.w32-in b/doc/emacs/makefile.w32-in
index ad976468be9..4064f4ef6a3 100644
--- a/doc/emacs/makefile.w32-in
+++ b/doc/emacs/makefile.w32-in
@@ -76,7 +76,7 @@ EMACSSOURCES= \
76 $(srcdir)/windows.texi \ 76 $(srcdir)/windows.texi \
77 $(srcdir)/frames.texi \ 77 $(srcdir)/frames.texi \
78 $(srcdir)/mule.texi \ 78 $(srcdir)/mule.texi \
79 $(srcdir)/major.texi \ 79 $(srcdir)/modes.texi \
80 $(srcdir)/indent.texi \ 80 $(srcdir)/indent.texi \
81 $(srcdir)/text.texi \ 81 $(srcdir)/text.texi \
82 $(srcdir)/programs.texi \ 82 $(srcdir)/programs.texi \
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index f83ac38469a..b7b634af8b1 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2794,7 +2794,6 @@ userenced and properbose. Have fun. Your buggestions are welcome.
2794@section Other Amusements 2794@section Other Amusements
2795@cindex boredom 2795@cindex boredom
2796@findex hanoi 2796@findex hanoi
2797@findex yow
2798@findex gomoku 2797@findex gomoku
2799@cindex tower of Hanoi 2798@cindex tower of Hanoi
2800 2799
@@ -2882,9 +2881,6 @@ Likewise, @kbd{M-x snake} provides an implementation of Snake.
2882 When you are frustrated, try the famous Eliza program. Just do 2881 When you are frustrated, try the famous Eliza program. Just do
2883@kbd{M-x doctor}. End each input by typing @key{RET} twice. 2882@kbd{M-x doctor}. End each input by typing @key{RET} twice.
2884 2883
2885@cindex Zippy
2886 When you are feeling strange, type @kbd{M-x yow}.
2887
2888@findex zone 2884@findex zone
2889The command @kbd{M-x zone} plays games with the display when Emacs is 2885The command @kbd{M-x zone} plays games with the display when Emacs is
2890idle. 2886idle.
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
new file mode 100644
index 00000000000..314d5d4347e
--- /dev/null
+++ b/doc/emacs/modes.texi
@@ -0,0 +1,410 @@
1@c This is part of the Emacs manual.
2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2011
3@c Free Software Foundation, Inc.
4@c See file emacs.texi for copying conditions.
5@node Modes, Indentation, International, Top
6@chapter Editing Modes
7
8 Emacs contains many @dfn{editing modes}, each of which alters its
9basic behavior in useful ways. These are divided into @dfn{major
10modes} and @dfn{minor modes}.
11
12 Major modes provide specialized facilities for working on a
13particular file type, such as a C source file (@pxref{Programs}), or a
14particular type of non-file buffer, such as a shell buffer
15(@pxref{Shell}). Major modes are mutually exclusive; each buffer has
16one and only one major mode at any time.
17
18 Minor modes are optional features which you can turn on or off, not
19necessarily specific to a type of file or buffer. For example, Auto
20Fill mode is a minor mode in which @key{SPC} breaks lines between
21words as you type (@pxref{Auto Fill}). Minor modes are independent of
22one another, and of the selected major mode.
23
24@menu
25* Major Modes:: Text mode vs. Lisp mode vs. C mode...
26* Minor Modes:: Each minor mode is a feature you can turn on
27 independently of any others.
28* Choosing Modes:: How modes are chosen when visiting files.
29@end menu
30
31@node Major Modes
32@section Major Modes
33@cindex major modes
34@cindex mode, major
35@kindex TAB @r{(and major modes)}
36@kindex DEL @r{(and major modes)}
37@kindex C-j @r{(and major modes)}
38
39 Every buffer possesses a major mode, which determines the editing
40behavior of Emacs while that buffer is current. The mode line
41normally shows the name of the current major mode, in parentheses.
42@xref{Mode Line}.
43
44 Usually, the major mode is automatically set by Emacs, when you
45first visit a file or create a buffer. @xref{Choosing Modes}. You
46can explicitly select a new major mode by using an @kbd{M-x} command.
47Take the name of the mode and add @code{-mode} to get the name of the
48command to select that mode. Thus, you can enter Lisp mode with
49@kbd{M-x lisp-mode}.
50
51 The least specialized major mode is called @dfn{Fundamental mode}.
52This mode has no mode-specific redefinitions or variable settings, so
53that each Emacs command behaves in its most general manner, and each
54user option variable is in its default state.
55
56 For editing text of a specific type that Emacs knows about, such as
57Lisp code or English text, you typically use a more specialized major
58mode, such as Lisp mode or Text mode. Such major modes change the
59meanings of some keys to become more specifically adapted to the
60language being edited. The ones that are commonly changed are
61@key{TAB}, @key{DEL}, and @kbd{C-j}. The prefix key @kbd{C-c}
62normally contains mode-specific commands. In addition, the commands
63which handle comments use the mode to determine how comments are to be
64delimited. Many major modes redefine the syntactical properties of
65characters appearing in the buffer.
66
67 The major modes fall into three major groups. The first group
68contains modes for normal text, either plain or with mark-up. It
69includes Text mode, HTML mode, SGML mode, @TeX{} mode and Outline
70mode. The second group contains modes for specific programming
71languages. These include Lisp mode (which has several variants), C
72mode, Fortran mode, and others. The remaining major modes are not
73intended for use on users' files; they are used in buffers created for
74specific purposes by Emacs, such as Dired mode for buffers made by
75Dired (@pxref{Dired}), Message mode for buffers made by @kbd{C-x m}
76(@pxref{Sending Mail}), and Shell mode for buffers used for
77communicating with an inferior shell process (@pxref{Interactive
78Shell}).
79
80 Most programming-language major modes specify that only blank lines
81separate paragraphs. This is to make the paragraph commands useful.
82(@xref{Paragraphs}.) They also cause Auto Fill mode to use the
83definition of @key{TAB} to indent the new lines it creates. This is
84because most lines in a program are usually indented
85(@pxref{Indentation}).
86
87@node Minor Modes
88@section Minor Modes
89@cindex minor modes
90@cindex mode, minor
91
92 A minor mode is an optional editing modes that alters the behavior
93of Emacs in some well-defined way. Unlike major modes, any number of
94minor modes can be in effect at any time. Some minor modes are
95@dfn{buffer-local}: they apply only to the current buffer, so you can
96enable the mode in certain buffers and not others. Other minor modes
97are @dfn{global}: while enabled, they affect everything you do in the
98Emacs session, in all buffers. Some global minor modes are enabled by
99default.
100
101 Most minor modes say in the mode line when they are enabled, just
102after the major mode indicator. For example, @samp{Fill} in the mode
103line means that Auto Fill mode is enabled. @xref{Mode Line}.
104
105 Each minor mode is associated with a command, called the @dfn{mode
106command}, which turns it on or off. The name of this command consists
107of the name of the minor mode, followed by @samp{-mode}; for instance,
108the mode command for Auto Fill mode is @code{auto-fill-mode}. Calling
109the minor mode command with no prefix argument @dfn{toggles} the mode,
110turning it on if it was off, and off if it was on. A positive
111argument always turns the mode on, and a zero or negative argument
112always turns it off. Mode commands are usually invoked with
113@kbd{M-x}, but you can bind keys to them if you wish (@pxref{Key
114Bindings}).
115
116 Most minor modes also have a @dfn{mode variable}, with the same name
117as the mode command. Its value is non-@code{nil} if the mode is
118enabled, and @code{nil} if it is disabled. In some minor modes---but
119not all---the value of the variable alone determines whether the mode
120is active: the mode command works simply by setting the variable, and
121changing the value of the variable has the same effect as calling the
122mode command. Because not all minor modes work this way, we recommend
123that you avoid changing the mode variables directly; use the mode
124commands instead.
125
126 The following is a list of some buffer-local minor modes:
127
128@itemize @bullet
129@item
130Abbrev mode automatically expands text based on pre-defined
131abbreviation definitions. @xref{Abbrevs}.
132
133@item
134Auto Fill mode inserts newlines as you type to prevent lines from
135becoming too long. @xref{Filling}.
136
137@item
138Auto Save mode saves the buffer contents periodically to reduce the
139amount of work you can lose in case of a crash. @xref{Auto Save}.
140
141@item
142Enriched mode enables editing and saving of formatted text.
143@xref{Formatted Text}.
144
145@item
146Flyspell mode automatically highlights misspelled words.
147@xref{Spelling}.
148
149@item
150Font-Lock mode automatically highlights certain textual units found in
151programs. It is enabled globally by default, but you can disable it
152in individual buffers. @xref{Faces}.
153
154@findex linum-mode
155@cindex Linum mode
156@item
157Linum mode displays each line's line number in the window's left
158margin. Its mode command is @code{linum-mode}.
159
160@item
161Outline minor mode provides similar facilities to the major mode
162called Outline mode. @xref{Outline Mode}.
163
164@cindex Overwrite mode
165@cindex mode, Overwrite
166@findex overwrite-mode
167@kindex INSERT
168@item
169Overwrite mode causes ordinary printing characters to replace existing
170text instead of shoving it to the right. For example, if point is in
171front of the @samp{B} in @samp{FOOBAR}, then in Overwrite mode typing
172a @kbd{G} changes it to @samp{FOOGAR}, instead of producing
173@samp{FOOGBAR} as usual. In Overwrite mode, the command @kbd{C-q}
174inserts the next character whatever it may be, even if it is a
175digit---this gives you a way to insert a character instead of
176replacing an existing character. The mode command,
177@code{overwrite-mode}, is bound to the @key{Insert} key.
178
179@findex binary-overwrite-mode
180@item
181Binary Overwrite mode is a variant of Overwrite mode for editing
182binary files; it treats newlines and tabs like other characters, so
183that they overwrite other characters and can be overwritten by them.
184In Binary Overwrite mode, digits after @kbd{C-q} specify an octal
185character code, as usual.
186
187@item
188Visual Line mode performs ``word wrapping'', causing long lines to be
189wrapped at word boundaries. @xref{Visual Line Mode}.
190@end itemize
191
192 Here are some useful global minor modes. Since Line Number mode and
193Transient Mark mode can be enabled or disabled just by setting the
194value of the minor mode variable, you @emph{can} set them differently
195for particular buffers, by explicitly making the corresponding
196variable local in those buffers. @xref{Locals}.
197
198@itemize @bullet
199@item
200Column Number mode enables display of the current column number in the
201mode line. @xref{Mode Line}.
202
203@item
204Delete Selection mode causes text insertion to first delete the text
205in the region, if the region is active. @xref{Using Region}.
206
207@item
208Icomplete mode displays an indication of available completions when
209you are in the minibuffer and completion is active. @xref{Completion
210Options}.
211
212@item
213Line Number mode enables display of the current line number in the
214mode line. It is enabled by default. @xref{Mode Line}.
215
216@item
217Menu Bar mode gives each frame a menu bar. It is enabled by default.
218@xref{Menu Bars}.
219
220@item
221Scroll Bar mode gives each window a scroll bar. It is enabled by
222default, but the scroll bar is only displayed on graphical terminals.
223@xref{Scroll Bars}.
224
225@item
226Tool Bar mode gives each frame a tool bar. It is enabled by default,
227but the tool bar is only displayed on graphical terminals. @xref{Tool
228Bars}.
229
230@item
231Transient Mark mode highlights the region, and makes many Emacs
232commands operate on the region when the mark is active. It is enabled
233by default. @xref{Mark}.
234@end itemize
235
236@node Choosing Modes
237@section Choosing File Modes
238
239@cindex choosing a major mode
240@cindex choosing a minor mode
241@vindex auto-mode-alist
242 When you visit a file, Emacs chooses a major mode automatically.
243Normally, it makes the choice based on the file name---for example,
244files whose names end in @samp{.c} are normally edited in C mode---but
245sometimes it chooses the major mode based on special text in the file.
246This special text can also be used to enable buffer-local minor modes.
247
248 Here is the exact procedure:
249
250 First, Emacs checks whether the file contains file-local mode
251variables. @xref{File Variables}. If there is a file-local variable
252that specifies a major mode, then Emacs uses that major mode, ignoring
253all other criteria. There are several methods to specify a major mode
254using a file-local variable; the simplest is to put the mode name in
255the first nonblank line, preceded and followed by @samp{-*-}. Other
256text may appear on the line as well. For example,
257
258@example
259; -*-Lisp-*-
260@end example
261
262@noindent
263tells Emacs to use Lisp mode. Note how the semicolon is used to make
264Lisp treat this line as a comment. Alternatively, you could write
265
266@example
267; -*- mode: Lisp;-*-
268@end example
269
270@noindent
271The latter format allows you to specify local variables as well, like
272this:
273
274@example
275; -*- mode: Lisp; tab-width: 4; -*-
276@end example
277
278 If a file variable specifies a buffer-local minor mode, Emacs
279enables that minor mode in the buffer.
280
281@vindex interpreter-mode-alist
282 Second, if there is no file variable specifying a major mode, Emacs
283checks whether the file's contents begin with @samp{#!}. If so, that
284indicates that the file can serve as an executable shell command,
285which works by running an interpreter named on the file's first line
286(the rest of the file is used as input to the interpreter).
287Therefore, Emacs tries to use the interpreter name to choose a mode.
288For instance, a file that begins with @samp{#!/usr/bin/perl} is opened
289in Perl mode. The variable @code{interpreter-mode-alist} specifies
290the correspondence between interpreter program names and major modes.
291
292 When the first line starts with @samp{#!}, you usually cannot use
293the @samp{-*-} feature on the first line, because the system would get
294confused when running the interpreter. So Emacs looks for @samp{-*-}
295on the second line in such files as well as on the first line. The
296same is true for man pages which start with the magic string
297@samp{'\"} to specify a list of troff preprocessors.
298
299@vindex magic-mode-alist
300 Third, Emacs tries to determine the major mode by looking at the
301text at the start of the buffer, based on the variable
302@code{magic-mode-alist}. By default, this variable is @code{nil} (an
303empty list), so Emacs skips this step; however, you can customize it
304in your init file (@pxref{Init File}). The value should be a list of
305elements of the form
306
307@example
308(@var{regexp} . @var{mode-function})
309@end example
310
311@noindent
312where @var{regexp} is a regular expression (@pxref{Regexps}), and
313@var{mode-function} is a Lisp function that toggles a major mode. If
314the text at the beginning of the file matches @var{regexp}, Emacs
315chooses the major mode specified by @var{mode-function}.
316
317Alternatively, an element of @code{magic-mode-alist} may have the form
318
319@example
320(@var{match-function} . @var{mode-function})
321@end example
322
323@noindent
324where @var{match-function} is a Lisp function that is called at the
325beginning of the buffer; if the function returns non-@code{nil}, Emacs
326set the major mode wit @var{mode-function}.
327
328 Fourth---if Emacs still hasn't found a suitable major mode---it
329looks at the file's name. The correspondence between file names and
330major modes is controlled by the variable @code{auto-mode-alist}. Its
331value is a list in which each element has this form,
332
333@example
334(@var{regexp} . @var{mode-function})
335@end example
336
337@noindent
338or this form,
339
340@example
341(@var{regexp} @var{mode-function} @var{flag})
342@end example
343
344@noindent
345For example, one element normally found in the list has the form
346@code{(@t{"\\.c\\'"} . c-mode)}, and it is responsible for selecting C
347mode for files whose names end in @file{.c}. (Note that @samp{\\} is
348needed in Lisp syntax to include a @samp{\} in the string, which must
349be used to suppress the special meaning of @samp{.} in regexps.) If
350the element has the form @code{(@var{regexp} @var{mode-function}
351@var{flag})} and @var{flag} is non-@code{nil}, then after calling
352@var{mode-function}, Emacs discards the suffix that matched
353@var{regexp} and searches the list again for another match.
354
355@vindex auto-mode-case-fold
356 On systems with case-insensitive file names, such as Microsoft
357Windows, Emacs performs a single case-insensitive search through
358@code{auto-mode-alist}. On other systems, Emacs normally performs a
359single case-sensitive search through the alist. However, if you
360change the variable @code{auto-mode-case-fold} to @code{t}, Emacs
361performs a second case-insensitive search if the first search fails.
362
363@vindex magic-fallback-mode-alist
364 Finally, if Emacs @emph{still} hasn't found a major mode to use, it
365compares the text at the start of the buffer to the variable
366@code{magic-fallback-mode-alist}. This variable works like
367@code{magic-mode-alist}, described above, except that is consulted
368only after @code{auto-mode-alist}. By default,
369@code{magic-fallback-mode-alist} contains forms that check for image
370files, HTML/XML/SGML files, and Postscript files.
371
372@vindex major-mode
373 Once a major mode is chosen, Emacs sets the value of the variable
374@code{major-mode} to the symbol for that major mode (e.g.,
375@code{text-mode} for Text mode). This is a per-buffer variable
376(@pxref{Locals}); its buffer-local value is set automatically, and you
377should not change it yourself.
378
379 The default value of @code{major-mode} determines the major mode to
380use for files that do not specify a major mode, and for new buffers
381created with @kbd{C-x b}. Normally, this default value is the symbol
382@code{fundamental-mode}, which specifies Fundamental mode. You can
383change it via the Customization interface (@pxref{Easy
384Customization}), or by adding a line like this to your init file
385(@pxref{Init File}):
386
387@smallexample
388(setq-default major-mode 'text-mode)
389@end smallexample
390
391@noindent
392If the default value of @code{major-mode} is @code{nil}, the major
393mode is taken from the previously current buffer.
394
395@findex normal-mode
396 If you have changed the major mode of a buffer, you can return to
397the major mode Emacs would have chosen automatically, by typing
398@kbd{M-x normal-mode}. This is the same function that
399@code{find-file} calls to choose the major mode. It also processes
400the file's @samp{-*-} line or local variables list (if any).
401@xref{File Variables}.
402
403@vindex change-major-mode-with-file-name
404 The commands @kbd{C-x C-w} and @code{set-visited-file-name} change to
405a new major mode if the new file name implies a mode (@pxref{Saving}).
406(@kbd{C-x C-s} does this too, if the buffer wasn't visiting a file.)
407However, this does not happen if the buffer contents specify a major
408mode, and certain ``special'' major modes do not allow the mode to
409change. You can turn off this mode-changing feature by setting
410@code{change-major-mode-with-file-name} to @code{nil}.
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 3f3da503769..3c970ecb12c 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1,7 +1,7 @@
1@c This is part of the Emacs manual. 1@c This is part of the Emacs manual.
2@c Copyright (C) 1997, 1999-2011 Free Software Foundation, Inc. 2@c Copyright (C) 1997, 1999-2011 Free Software Foundation, Inc.
3@c See file emacs.texi for copying conditions. 3@c See file emacs.texi for copying conditions.
4@node International, Major Modes, Frames, Top 4@node International, Modes, Frames, Top
5@chapter International Character Set Support 5@chapter International Character Set Support
6@c This node is referenced in the tutorial. When renaming or deleting 6@c This node is referenced in the tutorial. When renaming or deleting
7@c it, the tutorial needs to be adjusted. (TUTORIAL.de) 7@c it, the tutorial needs to be adjusted. (TUTORIAL.de)
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 803f6b6ce49..870986d421a 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -643,8 +643,9 @@ balanced.
643 When talking about these facilities, the term ``parenthesis'' also 643 When talking about these facilities, the term ``parenthesis'' also
644includes braces, brackets, or whatever delimiters are defined to match 644includes braces, brackets, or whatever delimiters are defined to match
645in pairs. The major mode controls which delimiters are significant, 645in pairs. The major mode controls which delimiters are significant,
646through the syntax table (@pxref{Syntax}). In Lisp, only parentheses 646through the syntax table (@pxref{Syntax Tables,, Syntax Tables, elisp,
647count; in C, these commands apply to braces and brackets too. 647The Emacs Lisp Reference Manual}). In Lisp, only parentheses count;
648in C, these commands apply to braces and brackets too.
648 649
649 You can use @kbd{M-x check-parens} to find any unbalanced 650 You can use @kbd{M-x check-parens} to find any unbalanced
650parentheses and unbalanced string quotes in the buffer. 651parentheses and unbalanced string quotes in the buffer.
diff --git a/doc/emacs/screen.texi b/doc/emacs/screen.texi
index 0bc3ce3db8c..145687270ca 100644
--- a/doc/emacs/screen.texi
+++ b/doc/emacs/screen.texi
@@ -190,7 +190,7 @@ sometimes useful to have this information.
190Systems}). If it is a dash (@samp{-}), that indicates the default 190Systems}). If it is a dash (@samp{-}), that indicates the default
191state of affairs: no special character set handling, except for the 191state of affairs: no special character set handling, except for the
192end-of-line translations described in the next paragraph. @samp{=} 192end-of-line translations described in the next paragraph. @samp{=}
193means no conversion whatsoever. Letters represent various nontrivial 193means no conversion whatsoever. Characters represent various nontrivial
194@dfn{coding systems}---for example, @samp{1} represents ISO Latin-1. 194@dfn{coding systems}---for example, @samp{1} represents ISO Latin-1.
195On a text-only terminal, @var{cs} is preceded by two additional 195On a text-only terminal, @var{cs} is preceded by two additional
196characters that describe the coding system for keyboard input and the 196characters that describe the coding system for keyboard input and the
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index b5d426210aa..015f9529b73 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -870,8 +870,9 @@ matches at the end of the buffer only if the contents end with a
870word-constituent character. 870word-constituent character.
871 871
872@item \w 872@item \w
873matches any word-constituent character. The syntax table 873matches any word-constituent character. The syntax table determines
874determines which characters these are. @xref{Syntax}. 874which characters these are. @xref{Syntax Tables,, Syntax Tables,
875elisp, The Emacs Lisp Reference Manual}.
875 876
876@item \W 877@item \W
877matches any character that is not a word-constituent. 878matches any character that is not a word-constituent.
@@ -892,7 +893,8 @@ symbol-constituent character.
892matches any character whose syntax is @var{c}. Here @var{c} is a 893matches any character whose syntax is @var{c}. Here @var{c} is a
893character that designates a particular syntax class: thus, @samp{w} 894character that designates a particular syntax class: thus, @samp{w}
894for word constituent, @samp{-} or @samp{ } for whitespace, @samp{.} 895for word constituent, @samp{-} or @samp{ } for whitespace, @samp{.}
895for ordinary punctuation, etc. @xref{Syntax}. 896for ordinary punctuation, etc. @xref{Syntax Tables,, Syntax Tables,
897elisp, The Emacs Lisp Reference Manual}.
896 898
897@item \S@var{c} 899@item \S@var{c}
898matches any character whose syntax is not @var{c}. 900matches any character whose syntax is not @var{c}.
@@ -911,8 +913,9 @@ matches any character that does @emph{not} belong to category
911@var{c}. 913@var{c}.
912@end table 914@end table
913 915
914 The constructs that pertain to words and syntax are controlled by the 916 The constructs that pertain to words and syntax are controlled by
915setting of the syntax table (@pxref{Syntax}). 917the setting of the syntax table. @xref{Syntax Tables,, Syntax Tables,
918elisp, The Emacs Lisp Reference Manual}.
916 919
917@node Regexp Example 920@node Regexp Example
918@section Regular Expression Example 921@section Regular Expression Example
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index c0139c60557..dbda771e6a3 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -154,9 +154,10 @@ the mark by one additional word. @kbd{M-@@} also accepts a numeric
154argument that says how many words to scan for the place to put the 154argument that says how many words to scan for the place to put the
155mark. 155mark.
156 156
157 The word commands' understanding of word boundaries is controlled 157 The word commands' understanding of word boundaries is controlled by
158by the syntax table. Any character can, for example, be declared to 158the syntax table. Any character can, for example, be declared to be a
159be a word delimiter. @xref{Syntax}. 159word delimiter. @xref{Syntax Tables,, Syntax Tables, elisp, The Emacs
160Lisp Reference Manual}.
160 161
161@node Sentences 162@node Sentences
162@section Sentences 163@section Sentences
@@ -406,8 +407,6 @@ Text}).
406* Fill Commands:: Commands to refill paragraphs and center lines. 407* Fill Commands:: Commands to refill paragraphs and center lines.
407* Fill Prefix:: Filling paragraphs that are indented or in a comment, etc. 408* Fill Prefix:: Filling paragraphs that are indented or in a comment, etc.
408* Adaptive Fill:: How Emacs can determine the fill prefix automatically. 409* Adaptive Fill:: How Emacs can determine the fill prefix automatically.
409* Refill:: Keeping paragraphs filled.
410* Longlines:: Editing text with very long lines.
411@end menu 410@end menu
412 411
413@node Auto Fill 412@node Auto Fill
@@ -722,92 +721,6 @@ line, and it should return the appropriate fill prefix based on that
722line. If it returns @code{nil}, @code{adaptive-fill-regexp} gets 721line. If it returns @code{nil}, @code{adaptive-fill-regexp} gets
723a chance to find a prefix. 722a chance to find a prefix.
724 723
725@node Refill
726@subsection Refill Mode
727@cindex refilling text, word processor style
728@cindex modes, Refill
729@cindex Refill minor mode
730
731 Refill minor mode provides support for keeping paragraphs filled as
732you type or modify them in other ways. It provides an effect similar
733to typical word processor behavior. This works by running a
734paragraph-filling command at suitable times.
735
736 To toggle the use of Refill mode in the current buffer, type
737@kbd{M-x refill-mode}. When you are typing text, only characters
738which normally trigger auto filling, like the space character, will
739trigger refilling. This is to avoid making it too slow. Apart from
740self-inserting characters, other commands which modify the text cause
741refilling.
742
743 The current implementation is preliminary and not robust. You can
744get better ``line wrapping'' behavior using Longlines mode.
745@xref{Longlines}. However, Longlines mode has an important
746side-effect: the newlines that it inserts for you are not saved to
747disk, so the files that you make with Longlines mode will appear to be
748completely unfilled if you edit them without Longlines mode.
749
750@node Longlines
751@subsection Long Lines Mode
752@cindex refilling text, word processor style
753@cindex modes, Long Lines
754@cindex word wrap
755@cindex Long Lines minor mode
756
757 Sometimes, you may come across ``unfilled'' text files, which Emacs
758normally displays as a bunch of extremely long lines. Comfortably
759reading and editing such files normally requires ``word wrap'', a
760feature that breaks up each long text line into multiple screen lines
761in a readable manner---by putting the breaks at word boundaries. Many
762text editors, such as those built into many web browsers, perform word
763wrapping by default.
764
765 There are two different minor modes in Emacs that perform word
766wrapping. The first is Visual Line mode, which does it by altering
767the behavior of screen line continuation. @xref{Visual Line Mode},
768for information about Visual Line mode.
769
770@findex longlines-mode
771 Instead of using Visual Line mode, you can use a minor mode called
772Long Lines mode. Long Lines mode wraps lines by inserting or deleting
773@dfn{soft newlines} as you type (@pxref{Hard and Soft Newlines}).
774These soft newlines won't show up when you save the buffer into a
775file, or when you copy the text into the kill ring, clipboard, or a
776register. Unlike Visual Line mode, Lone Lines mode breaks long lines
777at the fill column (@pxref{Fill Commands}), rather than the right
778window edge. To enable Long Lines mode, type @kbd{M-x
779longlines-mode}. If the text is full of long lines, this also
780immediately ``wraps'' them all.
781
782@findex longlines-auto-wrap
783 The word wrap performed by Long Lines mode is @emph{not} the same as
784ordinary filling (@pxref{Fill Commands}). It does not contract
785multiple spaces into a single space, recognize fill prefixes
786(@pxref{Fill Prefix}), or perform adaptive filling (@pxref{Adaptive
787Fill}). The reason for this is that a wrapped line is still,
788conceptually, a single line. Each soft newline is equivalent to
789exactly one space in that long line, and vice versa. However, you can
790still call filling functions such as @kbd{M-q}, and these will work as
791expected, inserting soft newlines that won't show up on disk or when
792the text is copied. You can even rely entirely on the normal fill
793commands by turning off automatic line wrapping, with @kbd{C-u M-x
794longlines-auto-wrap}. To turn automatic line wrapping back on, type
795@kbd{M-x longlines-auto-wrap}.
796
797@findex longlines-show-hard-newlines
798 Type @kbd{RET} to insert a hard newline, one which automatic
799refilling will not remove. If you want to see where all the hard
800newlines are, type @kbd{M-x longlines-show-hard-newlines}. This will
801mark each hard newline with a special symbol. The same command with a
802prefix argument turns this display off.
803
804 Long Lines mode does not change normal text files that are already
805filled, since the existing newlines are considered hard newlines.
806Before Long Lines can do anything, you need to transform each
807paragraph into a long line. One way is to set @code{fill-column} to a
808large number (e.g., @kbd{C-u 9999 C-x f}), re-fill all the paragraphs,
809and then set @code{fill-column} back to its original value.
810
811@node Case 724@node Case
812@section Case Conversion Commands 725@section Case Conversion Commands
813@cindex case conversion 726@cindex case conversion
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 7e8dac0cb27..c265b9e878d 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,11 @@
12011-07-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * modes.texi (Mode Line Variables): Document `mode-line-remote'
4 and `mode-line-client' (bug#2974).
5
6 * text.texi (Insertion): Clarify marker movements (bug#1651).
7 Text from Drew Adams.
8
12011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org> 92011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 10
3 * text.texi (Special Properties): Clarify the format of `face' 11 * text.texi (Special Properties): Clarify the format of `face'
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 562cc76c3f0..a8a10f750cc 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1866,6 +1866,15 @@ default value also displays the recursive editing level, information
1866on the process status, and whether narrowing is in effect. 1866on the process status, and whether narrowing is in effect.
1867@end defopt 1867@end defopt
1868 1868
1869@defopt mode-line-remote
1870This variable is used to show whether @code{default-directory} for the
1871current buffer is remote.
1872@end defopt
1873
1874@defopt mode-line-client
1875This variable is used to identify @code{emacsclient} frames.
1876@end defopt
1877
1869 The following three variables are used in @code{mode-line-modes}: 1878 The following three variables are used in @code{mode-line-modes}:
1870 1879
1871@defvar mode-name 1880@defvar mode-name
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 2d487352243..b91afb044f0 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -364,14 +364,13 @@ after point. Some insertion functions leave point before the inserted
364text, while other functions leave it after. We call the former 364text, while other functions leave it after. We call the former
365insertion @dfn{after point} and the latter insertion @dfn{before point}. 365insertion @dfn{after point} and the latter insertion @dfn{before point}.
366 366
367 Insertion relocates markers that point at positions after the 367 Insertion moves markers located at positions after the insertion
368insertion point, so that they stay with the surrounding text 368point, so that they stay with the surrounding text (@pxref{Markers}).
369(@pxref{Markers}). When a marker points at the place of insertion, 369When a marker points at the place of insertion, insertion may or may
370insertion may or may not relocate the marker, depending on the marker's 370not relocate the marker, depending on the marker's insertion type
371insertion type (@pxref{Marker Insertion Types}). Certain special 371(@pxref{Marker Insertion Types}). Certain special functions such as
372functions such as @code{insert-before-markers} relocate all such markers 372@code{insert-before-markers} relocate all such markers to point after
373to point after the inserted text, regardless of the markers' insertion 373the inserted text, regardless of the markers' insertion type.
374type.
375 374
376 Insertion functions signal an error if the current buffer is 375 Insertion functions signal an error if the current buffer is
377read-only or if they insert within read-only text. 376read-only or if they insert within read-only text.