comparison lispintro/emacs-lisp-intro.texi @ 51945:bfb22215769d

Revise various segments, fix typos, add GNU Press information, add RMS essay on need for documentation, update documentation license.
author Robert J. Chassell <bob@rattlesnake.com>
date Wed, 16 Jul 2003 19:00:29 +0000
parents aef53887e0ed
children 695cf19ef79e
comparison
equal deleted inserted replaced
51944:4bfad02b45db 51945:bfb22215769d
1 \input texinfo @c -*-texinfo-*- 1 \input texinfo @c -*-texinfo-*-
2 @comment %**start of header 2 @comment %**start of header
3 @setfilename ../info/eintr 3 @setfilename ../info/eintr
4 @c sethtmlfilename emacs-lisp-intro.html 4 @c sethtmlfilename emacs-lisp-intro.html
5 @settitle Programming in Emacs Lisp 5 @settitle Programming in Emacs Lisp
6 @syncodeindex vr cp 6 @syncodeindex vr cp
11 @c --------- 11 @c ---------
12 @c <<<< For hard copy printing, this file is now 12 @c <<<< For hard copy printing, this file is now
13 @c set for smallbook, which works for all sizes 13 @c set for smallbook, which works for all sizes
14 @c of paper, and with Postscript figures >>>> 14 @c of paper, and with Postscript figures >>>>
15 @smallbook 15 @smallbook
16 @clear largebook 16 @clear largebook
17 @set print-postscript-figures 17 @set print-postscript-figures
18 @c set largebook 18 @c set largebook
19 @c clear print-postscript-figures 19 @c clear print-postscript-figures
20 @c --------- 20 @c ---------
21 21
22 @comment %**end of header 22 @comment %**end of header
23 23
24 @set edition-number 2.07 24 @set edition-number 2.10
25 @set update-date 2003 Apr 17 25 @set update-date 2003 July 15
26 26
27 @ignore 27 @ignore
28 ## Summary of shell commands to create various output formats: 28 ## Summary of shell commands to create various output formats:
29 29
30 ## Info output 30 ## Info output
45 --verbose emacs-lisp-intro.texi 45 --verbose emacs-lisp-intro.texi
46 46
47 ## XML output 47 ## XML output
48 makeinfo --xml --no-split --paragraph-indent=0 \ 48 makeinfo --xml --no-split --paragraph-indent=0 \
49 --verbose emacs-lisp-intro.texi 49 --verbose emacs-lisp-intro.texi
50
51 #### (You must be in the same directory as the viewed file.)
52
53 ## View DVI output
54 xdvi emacs-lisp-intro.dvi &
55
56 ## View HTML output
57 galeon emacs-lisp-intro.html
58
59 ## View Info output with standalone reader
60 info emacs-lisp-intro.info
50 61
51 @end ignore 62 @end ignore
52 63
53 @c ================ Included Figures ================ 64 @c ================ Included Figures ================
54 65
142 @end tex 153 @end tex
143 @end ifset 154 @end ifset
144 155
145 @c For all sized formats: print within-book cross 156 @c For all sized formats: print within-book cross
146 @c reference with ``...'' rather than [...] 157 @c reference with ``...'' rather than [...]
158
159 @c This works with the texinfo.tex file, version 2003-05-04.08,
160 @c in the Texinfo version 4.6 of the 2003 Jun 13 distribution.
161
147 @tex 162 @tex
148 % Need following so comma appears after section numbers. 163 \global\def\xrefprintnodename#1{``#1''}
149 \global\def\Ysectionnumberandtype{%
150 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno, \space %
151 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno, \space %
152 \else \ifnum \subsubsecno=0 %
153 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno, \space %
154 \else %
155 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno, \space%
156 \fi \fi \fi }
157
158 \global\def\Yappendixletterandtype{%
159 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}, \space%
160 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno, \space %
161 \else \ifnum \subsubsecno=0 %
162 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno, \space %
163 \else %
164 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno, \space %
165 \fi \fi \fi }
166
167 \global\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
168 \def\printedmanual{\ignorespaces #5}%
169 \def\printednodename{\ignorespaces #3}%
170 \setbox1=\hbox{\printedmanual}%
171 \setbox0=\hbox{\printednodename}%
172 \ifdim \wd0 = 0pt
173 % No printed node name was explicitly given.
174 \ifx\SETxref-automatic-section-title\relax %
175 % Use the actual chapter/section title appear inside
176 % the square brackets. Use the real section title if we have it.
177 \ifdim \wd1>0pt%
178 % It is in another manual, so we don't have it.
179 \def\printednodename{\ignorespaces #1}%
180 \else
181 \ifhavexrefs
182 % We know the real title if we have the xref values.
183 \def\printednodename{\refx{#1-title}}%
184 \else
185 % Otherwise just copy the Info node name.
186 \def\printednodename{\ignorespaces #1}%
187 \fi%
188 \fi
189 \def\printednodename{#1-title}%
190 \else
191 % Use the node name inside the square brackets.
192 \def\printednodename{\ignorespaces #1}%
193 \fi
194 \fi
195 %
196 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
197 % insert empty discretionaries after hyphens, which means that it will
198 % not find a line break at a hyphen in a node names. Since some manuals
199 % are best written with fairly long node names, containing hyphens, this
200 % is a loss. Therefore, we give the text of the node name again, so it
201 % is as if TeX is seeing it for the first time.
202 \ifdim \wd1 > 0pt
203 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
204 \else
205 % _ (for example) has to be the character _ for the purposes of the
206 % control sequence corresponding to the node, but it has to expand
207 % into the usual \leavevmode...\vrule stuff for purposes of
208 % printing. So we \turnoffactive for the \refx-snt, back on for the
209 % printing, back off for the \refx-pg.
210 {\turnoffactive \refx{#1-snt}{}}%
211 % \space [\printednodename],\space % <= original
212 % \putwordsection{} ``\printednodename'',\space
213 ``\printednodename'',\space
214 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
215 \fi
216 \endgroup}
217 @end tex 164 @end tex
218 165
219 @c ---------------------------------------------------- 166 @c ----------------------------------------------------
220 167
221 @dircategory Emacs 168 @dircategory Emacs
223 * Emacs Lisp Intro: (eintr). 170 * Emacs Lisp Intro: (eintr).
224 A simple introduction to Emacs Lisp programming. 171 A simple introduction to Emacs Lisp programming.
225 @end direntry 172 @end direntry
226 173
227 @copying 174 @copying
228 This is an introduction to @cite{Programming in Emacs Lisp}, for 175 This is an @cite{Introduction to Programming in Emacs Lisp}, for
229 people who are not programmers. 176 people who are not programmers.
230 177 @sp 1
231 Edition @value{edition-number}, @value{update-date} 178 Edition @value{edition-number}, @value{update-date}
232 179 @sp 1
233 Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, 180 Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001,
234 2002, 2003 Free Software Foundation, Inc. 181 2002, 2003 Free Software Foundation, Inc.
235 @sp 2 182 @sp 1
236 183
237 Published by the Free Software Foundation, Inc.@* 184 @iftex
238 59 Temple Place, Suite 330@* 185 Published by the:@*
239 Boston, MA 02111-1307 USA@* 186
240 187 GNU Press, @hfill @uref{http://www.gnupress.org}@*
188 a division of the @hfill General: @email{press@@gnu.org}@*
189 Free Software Foundation, Inc. @hfill Orders:@w{ } @email{sales@@gnu.org}@*
190 59 Temple Place, Suite 330 @hfill Tel: +1 (617) 542-5942@*
191 Boston, MA 02111-1307 USA @hfill Fax: +1 (617) 542-2652@*
192 @end iftex
193
194 @ifnottex
195 Published by the:
196
197 @example
198 GNU Press, Website: http://www.gnupress.org
199 a division of the General: press@@gnu.org
200 Free Software Foundation, Inc. Orders: sales@@gnu.org
201 59 Temple Place, Suite 330 Tel: +1 (617) 542-5942
202 Boston, MA 02111-1307 USA Fax: +1 (617) 542-2652
203 @end example
204 @end ifnottex
205
206 @sp 1
241 @c Printed copies are available for $30 each.@* 207 @c Printed copies are available for $30 each.@*
242 ISBN 1-882114-43-4 208 ISBN 1-882114-43-4
243 209
244 Permission is granted to copy, distribute and/or modify this document 210 Permission is granted to copy, distribute and/or modify this document
245 under the terms of the GNU Free Documentation License, Version 1.1 or 211 under the terms of the GNU Free Documentation License, Version 1.1 or
268 @sp 6 234 @sp 6
269 @center @titlefont{An Introduction to} 235 @center @titlefont{An Introduction to}
270 @sp 2 236 @sp 2
271 @center @titlefont{Programming in Emacs Lisp} 237 @center @titlefont{Programming in Emacs Lisp}
272 @sp 2 238 @sp 2
273 @center Second Edition 239 @center Revised Second Edition
274 @sp 4 240 @sp 4
275 @center by Robert J. Chassell 241 @center by Robert J. Chassell
276 242
277 @page 243 @page
278 @vskip 0pt plus 1filll 244 @vskip 0pt plus 1filll
284 @evenheading @thispage @| @| @thischapter 250 @evenheading @thispage @| @| @thischapter
285 @oddheading @thissection @| @| @thispage 251 @oddheading @thissection @| @| @thispage
286 @end iftex 252 @end iftex
287 253
288 @ifnothtml 254 @ifnothtml
289 255 @c Keep T.O.C. short by tightening up for largebook
290 @c Keep T.O.C. short by tightening up.
291 @ifset largebook 256 @ifset largebook
292 @tex 257 @tex
293 \global\parskip 2pt plus 1pt 258 \global\parskip 2pt plus 1pt
294 \global\advance\baselineskip by -1pt 259 \global\advance\baselineskip by -1pt
295 @end tex 260 @end tex
296 @end ifset 261 @end ifset
262 @end ifnothtml
297 263
298 @shortcontents 264 @shortcontents
299 @contents 265 @contents
300
301 @ifset largebook
302 @tex
303 \global\parskip 6pt plus 1pt
304 \global\advance\baselineskip by 1pt
305 @end tex
306 @end ifset
307
308 @end ifnothtml
309
310 @c >>>> Set pageno appropriately <<<<
311
312 @c The first page of the Preface is a roman numeral; it is the first
313 @c right handed page after the Table of Contents; hence the following
314 @c setting must be for an odd negative number.
315
316 @c if largebook, there are 8 pages in Table of Contents
317 @ifset largebook
318 @iftex
319 @pageno = -9
320 @end iftex
321 @end ifset
322
323 @c if smallbook, there are 10 pages in Table of Contents
324 @ifclear largebook
325 @iftex
326 @pageno = -11
327 @end iftex
328 @end ifclear
329 266
330 @ifnottex 267 @ifnottex
331 @node Top, Preface, (dir), (dir) 268 @node Top, Preface, (dir), (dir)
332 @top An Introduction to Programming in Emacs Lisp 269 @top An Introduction to Programming in Emacs Lisp
333 270
359 * Debugging:: How to run the Emacs Lisp debuggers. 296 * Debugging:: How to run the Emacs Lisp debuggers.
360 * Conclusion:: Now you have the basics. 297 * Conclusion:: Now you have the basics.
361 * the-the:: An appendix: how to find reduplicated words. 298 * the-the:: An appendix: how to find reduplicated words.
362 * Kill Ring:: An appendix: how the kill ring works. 299 * Kill Ring:: An appendix: how the kill ring works.
363 * Full Graph:: How to create a graph with labelled axes. 300 * Full Graph:: How to create a graph with labelled axes.
301 * Free Software and Free Manuals::
364 * GNU Free Documentation License:: 302 * GNU Free Documentation License::
365 * Index:: 303 * Index::
366 * About the Author:: 304 * About the Author::
367 305
368 @detailmenu 306 @detailmenu
778 Handling the Kill Ring 716 Handling the Kill Ring
779 717
780 * rotate-yank-pointer:: Move a pointer along a list and around. 718 * rotate-yank-pointer:: Move a pointer along a list and around.
781 * yank:: Paste a copy of a clipped element. 719 * yank:: Paste a copy of a clipped element.
782 * yank-pop:: Insert first element pointed to. 720 * yank-pop:: Insert first element pointed to.
721 * ring file::
783 722
784 The @code{rotate-yank-pointer} Function 723 The @code{rotate-yank-pointer} Function
785 724
786 * Understanding rotate-yk-ptr:: 725 * Understanding rotate-yk-ptr::
787 * rotate-yk-ptr body:: The body of @code{rotate-yank-pointer}. 726 * rotate-yk-ptr body:: The body of @code{rotate-yank-pointer}.
830 * Another Bug:: Yet another bug @dots{} most insidious. 769 * Another Bug:: Yet another bug @dots{} most insidious.
831 * Final printed graph:: The graph itself! 770 * Final printed graph:: The graph itself!
832 771
833 @end detailmenu 772 @end detailmenu
834 @end menu 773 @end menu
774
775 @c >>>> Set pageno appropriately <<<<
776
777 @c The first page of the Preface is a roman numeral; it is the first
778 @c right handed page after the Table of Contents; hence the following
779 @c setting must be for an odd negative number.
780
781 @iftex
782 @global@pageno = -11
783 @end iftex
835 784
836 @node Preface, List Processing, Top, Top 785 @node Preface, List Processing, Top, Top
837 @comment node-name, next, previous, up 786 @comment node-name, next, previous, up
838 @unnumbered Preface 787 @unnumbered Preface
839 788
1089 1038
1090 @iftex 1039 @iftex
1091 @headings off 1040 @headings off
1092 @evenheading @thispage @| @| @thischapter 1041 @evenheading @thispage @| @| @thischapter
1093 @oddheading @thissection @| @| @thispage 1042 @oddheading @thissection @| @| @thispage
1094 @pageno = 1 1043 @global@pageno = 1
1095 @end iftex 1044 @end iftex
1096 1045
1097 @node List Processing, Practicing Evaluation, Preface, Top 1046 @node List Processing, Practicing Evaluation, Preface, Top
1098 @comment node-name, next, previous, up 1047 @comment node-name, next, previous, up
1099 @chapter List Processing 1048 @chapter List Processing
1541 @code{+}, is not itself the set of instructions for the computer to 1490 @code{+}, is not itself the set of instructions for the computer to
1542 carry out. Instead, the symbol is used, perhaps temporarily, as a way 1491 carry out. Instead, the symbol is used, perhaps temporarily, as a way
1543 of locating the definition or set of instructions. What we see is the 1492 of locating the definition or set of instructions. What we see is the
1544 name through which the instructions can be found. Names of people 1493 name through which the instructions can be found. Names of people
1545 work the same way. I can be referred to as @samp{Bob}; however, I am 1494 work the same way. I can be referred to as @samp{Bob}; however, I am
1546 not the letters @samp{B}, @samp{o}, @samp{b} but am the consciousness 1495 not the letters @samp{B}, @samp{o}, @samp{b} but am, or were, the
1547 consistently associated with a particular life-form. The name is not 1496 consciousness consistently associated with a particular life-form.
1548 me, but it can be used to refer to me. 1497 The name is not me, but it can be used to refer to me.
1549 1498
1550 In Lisp, one set of instructions can be attached to several names. 1499 In Lisp, one set of instructions can be attached to several names.
1551 For example, the computer instructions for adding numbers can be 1500 For example, the computer instructions for adding numbers can be
1552 linked to the symbol @code{plus} as well as to the symbol @code{+} 1501 linked to the symbol @code{plus} as well as to the symbol @code{+}
1553 (and are in some dialects of Lisp). Among humans, I can be referred 1502 (and are in some dialects of Lisp). Among humans, I can be referred
2007 The type of data that should be passed to a function depends on what 1956 The type of data that should be passed to a function depends on what
2008 kind of information it uses. The arguments to a function such as 1957 kind of information it uses. The arguments to a function such as
2009 @code{+} must have values that are numbers, since @code{+} adds numbers. 1958 @code{+} must have values that are numbers, since @code{+} adds numbers.
2010 Other functions use different kinds of data for their arguments. 1959 Other functions use different kinds of data for their arguments.
2011 1960
1961 @need 1250
2012 @findex concat 1962 @findex concat
2013 For example, the @code{concat} function links together or unites two or 1963 For example, the @code{concat} function links together or unites two or
2014 more strings of text to produce a string. The arguments are strings. 1964 more strings of text to produce a string. The arguments are strings.
2015 Concatenating the two character strings @code{abc}, @code{def} produces 1965 Concatenating the two character strings @code{abc}, @code{def} produces
2016 the single string @code{abcdef}. This can be seen by evaluating the 1966 the single string @code{abcdef}. This can be seen by evaluating the
2323 for @samp{%s}: 2273 for @samp{%s}:
2324 2274
2325 @smallexample 2275 @smallexample
2326 @group 2276 @group
2327 (message "He saw %d %s" 2277 (message "He saw %d %s"
2328 (- fill-column 34) 2278 (- fill-column 32)
2329 (concat "red " 2279 (concat "red "
2330 (substring 2280 (substring
2331 "The quick brown foxes jumped." 16 21) 2281 "The quick brown foxes jumped." 16 21)
2332 " leaping.")) 2282 " leaping."))
2333 @end group 2283 @end group
2535 2485
2536 Learning Lisp is like climbing a hill in which the first part is the 2486 Learning Lisp is like climbing a hill in which the first part is the
2537 steepest. You have now climbed the most difficult part; what remains 2487 steepest. You have now climbed the most difficult part; what remains
2538 becomes easier as you progress onwards. 2488 becomes easier as you progress onwards.
2539 2489
2490 @need 1000
2540 In summary, 2491 In summary,
2541 2492
2542 @itemize @bullet 2493 @itemize @bullet
2543 2494
2544 @item 2495 @item
3534 each argument by adding parts to the string that follows 3485 each argument by adding parts to the string that follows
3535 @code{interactive}. When you do this, the information is passed to 3486 @code{interactive}. When you do this, the information is passed to
3536 each argument in the same order it is specified in the 3487 each argument in the same order it is specified in the
3537 @code{interactive} list. In the string, each part is separated from 3488 @code{interactive} list. In the string, each part is separated from
3538 the next part by a @samp{\n}, which is a newline. For example, you 3489 the next part by a @samp{\n}, which is a newline. For example, you
3539 could follow @code{"BAppend to buffer:@: "} with a @samp{\n}) and an 3490 could follow @code{"BAppend to buffer:@: "} with a @samp{\n} and an
3540 @samp{r}. This would cause Emacs to pass the values of point and mark 3491 @samp{r}. This would cause Emacs to pass the values of point and mark
3541 to the function as well as prompt you for the buffer---three arguments 3492 to the function as well as prompt you for the buffer---three arguments
3542 in all. 3493 in all.
3543 3494
3544 In this case, the function definition would look like the following, 3495 In this case, the function definition would look like the following,
4391 or more parts that pass the information to the arguments of the 4342 or more parts that pass the information to the arguments of the
4392 function, in sequence. These parts may also tell the interpreter to 4343 function, in sequence. These parts may also tell the interpreter to
4393 prompt for information. Parts of the string are separated by 4344 prompt for information. Parts of the string are separated by
4394 newlines, @samp{\n}. 4345 newlines, @samp{\n}.
4395 4346
4347 @need 1000
4396 Common code characters are: 4348 Common code characters are:
4397 4349
4398 @table @code 4350 @table @code
4399 @item b 4351 @item b
4400 The name of an existing buffer. 4352 The name of an existing buffer.
4521 @item message 4473 @item message
4522 Print a message in the echo area. The first argument is a string that 4474 Print a message in the echo area. The first argument is a string that
4523 can contain @samp{%s}, @samp{%d}, or @samp{%c} to print the value of 4475 can contain @samp{%s}, @samp{%d}, or @samp{%c} to print the value of
4524 arguments that follow the string. The argument used by @samp{%s} must 4476 arguments that follow the string. The argument used by @samp{%s} must
4525 be a string or a symbol; the argument used by @samp{%d} must be a 4477 be a string or a symbol; the argument used by @samp{%d} must be a
4526 number. The argument used by @samp{%c} must be an ascii code number; 4478 number. The argument used by @samp{%c} must be an @sc{ascii} code
4527 it will be printed as the character with that @sc{ascii} code. 4479 number; it will be printed as the character with that @sc{ascii} code.
4528 4480
4529 @item setq 4481 @item setq
4530 @itemx set 4482 @itemx set
4531 The @code{setq} function sets the value of its first argument to the 4483 The @code{setq} function sets the value of its first argument to the
4532 value of the second argument. The first argument is automatically 4484 value of the second argument. The first argument is automatically
4630 4582
4631 @cindex Find source of function 4583 @cindex Find source of function
4632 In versions 20 and higher, when a function is written in Emacs Lisp, 4584 In versions 20 and higher, when a function is written in Emacs Lisp,
4633 @code{describe-function} will also tell you the location of the 4585 @code{describe-function} will also tell you the location of the
4634 function definition. If you move point over the file name and press 4586 function definition. If you move point over the file name and press
4635 the @key{RET} key, which is this case means @code{help-follow} rather 4587 the @key{RET} key, which in this case means @code{help-follow} rather
4636 than `return' or `enter', Emacs will take you directly to the function 4588 than `return' or `enter', Emacs will take you directly to the function
4637 definition. 4589 definition.
4638 4590
4639 More generally, if you want to see a function in its original source 4591 More generally, if you want to see a function in its original source
4640 file, you can use the @code{find-tags} function to jump to it. 4592 file, you can use the @code{find-tags} function to jump to it.
4645 4597
4646 The @code{find-tags} function depends on `tags tables' that record 4598 The @code{find-tags} function depends on `tags tables' that record
4647 the locations of the functions, variables, and other items to which 4599 the locations of the functions, variables, and other items to which
4648 @code{find-tags} jumps. 4600 @code{find-tags} jumps.
4649 4601
4650 To use the @code{find-tags} command, type @kbd{M-.} (i.e., type the 4602 To use the @code{find-tags} command, type @kbd{M-.} (i.e., press the
4651 @key{META} key and the period key at the same time, or else type the 4603 period key while holding down the @key{META} key, or else type the
4652 @key{ESC} key and then type the period key), and then, at the prompt, 4604 @key{ESC} key and then type the period key), and then, at the prompt,
4653 type in the name of the function whose source code you want to see, 4605 type in the name of the function whose source code you want to see,
4654 such as @code{mark-whole-buffer}, and then type @key{RET}. Emacs will 4606 such as @code{mark-whole-buffer}, and then type @key{RET}. Emacs will
4655 switch buffers and display the source code for the function on your 4607 switch buffers and display the source code for the function on your
4656 screen. To switch back to your current buffer, type @kbd{C-x b 4608 screen. To switch back to your current buffer, type @kbd{C-x b
4666 interested in Emacs sources, the tags table you will most likely want, 4618 interested in Emacs sources, the tags table you will most likely want,
4667 if it has already been created for you, will be in a subdirectory of 4619 if it has already been created for you, will be in a subdirectory of
4668 the @file{/usr/local/share/emacs/} directory; thus you would use the 4620 the @file{/usr/local/share/emacs/} directory; thus you would use the
4669 @code{M-x visit-tags-table} command and specify a pathname such as 4621 @code{M-x visit-tags-table} command and specify a pathname such as
4670 @file{/usr/local/share/emacs/21.0.100/lisp/TAGS} or 4622 @file{/usr/local/share/emacs/21.0.100/lisp/TAGS} or
4671 @file{/usr/local/src/emacs/lisp/TAGS}. If the tags table has 4623 @file{/usr/local/src/emacs/src/TAGS}. If the tags table has
4672 not already been created, you will have to create it yourself. 4624 not already been created, you will have to create it yourself.
4673 4625
4674 @need 1250 4626 @need 1250
4675 To create a @file{TAGS} file in a specific directory, switch to that 4627 To create a @file{TAGS} file in a specific directory, switch to that
4676 directory in Emacs using @kbd{M-x cd} command, or list the directory 4628 directory in Emacs using @kbd{M-x cd} command, or list the directory
4891 The next line is an @code{(interactive)} expression that tells Emacs 4843 The next line is an @code{(interactive)} expression that tells Emacs
4892 that the function will be used interactively. These details are similar 4844 that the function will be used interactively. These details are similar
4893 to the @code{simplified-beginning-of-buffer} function described in the 4845 to the @code{simplified-beginning-of-buffer} function described in the
4894 previous section. 4846 previous section.
4895 4847
4848 @need 1250
4896 @node Body of mark-whole-buffer, , mark-whole-buffer overview, mark-whole-buffer 4849 @node Body of mark-whole-buffer, , mark-whole-buffer overview, mark-whole-buffer
4897 @comment node-name, next, previous, up 4850 @comment node-name, next, previous, up
4898 @subsection Body of @code{mark-whole-buffer} 4851 @subsection Body of @code{mark-whole-buffer}
4899 4852
4900 The body of the @code{mark-whole-buffer} function consists of three 4853 The body of the @code{mark-whole-buffer} function consists of three
5475 @code{insert-buffer} is yet another buffer-related function. This 5428 @code{insert-buffer} is yet another buffer-related function. This
5476 command copies another buffer @emph{into} the current buffer. It is the 5429 command copies another buffer @emph{into} the current buffer. It is the
5477 reverse of @code{append-to-buffer} or @code{copy-to-buffer}, since they 5430 reverse of @code{append-to-buffer} or @code{copy-to-buffer}, since they
5478 copy a region of text @emph{from} the current buffer to another buffer. 5431 copy a region of text @emph{from} the current buffer to another buffer.
5479 5432
5433 Here is a discussion based on the original code. The code was
5434 simplified in 2003 and is harder to understand.
5435
5480 In addition, this code illustrates the use of @code{interactive} with a 5436 In addition, this code illustrates the use of @code{interactive} with a
5481 buffer that might be @dfn{read-only} and the important distinction 5437 buffer that might be @dfn{read-only} and the important distinction
5482 between the name of an object and the object actually referred to. 5438 between the name of an object and the object actually referred to.
5483 5439
5484 @menu 5440 @menu
5828 the @code{let} expression, the @code{(push-mark newmark)} expression 5784 the @code{let} expression, the @code{(push-mark newmark)} expression
5829 function sets a mark to this location. (The previous location of the 5785 function sets a mark to this location. (The previous location of the
5830 mark is still accessible; it is recorded on the mark ring and you can 5786 mark is still accessible; it is recorded on the mark ring and you can
5831 go back to it with @kbd{C-u C-@key{SPC}}.) Meanwhile, point is 5787 go back to it with @kbd{C-u C-@key{SPC}}.) Meanwhile, point is
5832 located at the beginning of the inserted text, which is where it was 5788 located at the beginning of the inserted text, which is where it was
5833 before you called the insert function. 5789 before you called the insert function, the position of which was saved
5790 by the first @code{save-excursion}.
5834 5791
5835 @need 1250 5792 @need 1250
5836 The whole @code{let} expression looks like this: 5793 The whole @code{let} expression looks like this:
5837 5794
5838 @smallexample 5795 @smallexample
6142 position in the buffer. 6099 position in the buffer.
6143 6100
6144 The number that results from all this is passed to @code{goto-char} and 6101 The number that results from all this is passed to @code{goto-char} and
6145 the cursor is moved to that point. 6102 the cursor is moved to that point.
6146 6103
6104 @need 1500
6147 @node beginning-of-buffer complete, , beginning-of-buffer opt arg, beginning-of-buffer 6105 @node beginning-of-buffer complete, , beginning-of-buffer opt arg, beginning-of-buffer
6148 @comment node-name, next, previous, up 6106 @comment node-name, next, previous, up
6149 @subsection The Complete @code{beginning-of-buffer} 6107 @subsection The Complete @code{beginning-of-buffer}
6150 6108
6151 @need 800 6109 @need 1000
6152 Here is the complete text of the @code{beginning-of-buffer} function: 6110 Here is the complete text of the @code{beginning-of-buffer} function:
6111 @sp 1
6153 6112
6154 @smallexample 6113 @smallexample
6155 @group 6114 @group
6156 (defun beginning-of-buffer (&optional arg) 6115 (defun beginning-of-buffer (&optional arg)
6157 "Move point to the beginning of the buffer; 6116 "Move point to the beginning of the buffer;
6158 leave mark at previous position. 6117 leave mark at previous position.
6159 With arg N, put point N/10 of the way 6118 With arg N, put point N/10 of the way
6160 from the true beginning. 6119 from the true beginning.
6120 @end group
6121 @group
6161 Don't use this in Lisp programs! 6122 Don't use this in Lisp programs!
6162 \(goto-char (point-min)) is faster 6123 \(goto-char (point-min)) is faster
6163 and does not set the mark." 6124 and does not set the mark."
6164 (interactive "P") 6125 (interactive "P")
6165 (push-mark) 6126 (push-mark)
6263 6224
6264 @node optional Exercise, , Second Buffer Related Review, More Complex 6225 @node optional Exercise, , Second Buffer Related Review, More Complex
6265 @section @code{optional} Argument Exercise 6226 @section @code{optional} Argument Exercise
6266 6227
6267 Write an interactive function with an optional argument that tests 6228 Write an interactive function with an optional argument that tests
6268 whether its argument, a number, is greater or less than the value of 6229 whether its argument, a number, is greater than or equal to, or else,
6269 @code{fill-column}, and tells you which, in a message. However, if you 6230 less than the value of @code{fill-column}, and tells you which, in a
6270 do not pass an argument to the function, use 56 as a default value. 6231 message. However, if you do not pass an argument to the function, use
6232 56 as a default value.
6271 6233
6272 @node Narrowing & Widening, car cdr & cons, More Complex, Top 6234 @node Narrowing & Widening, car cdr & cons, More Complex, Top
6273 @comment node-name, next, previous, up 6235 @comment node-name, next, previous, up
6274 @chapter Narrowing and Widening 6236 @chapter Narrowing and Widening
6275 @cindex Focusing attention (narrowing) 6237 @cindex Focusing attention (narrowing)
6394 @cindex Widening, example of 6356 @cindex Widening, example of
6395 6357
6396 The @code{what-line} command tells you the number of the line in which 6358 The @code{what-line} command tells you the number of the line in which
6397 the cursor is located. The function illustrates the use of the 6359 the cursor is located. The function illustrates the use of the
6398 @code{save-restriction} and @code{save-excursion} commands. Here is the 6360 @code{save-restriction} and @code{save-excursion} commands. Here is the
6399 text of the function in full: 6361 original text of the function:
6400 6362
6401 @smallexample 6363 @smallexample
6402 @group 6364 @group
6403 (defun what-line () 6365 (defun what-line ()
6404 "Print the current line number (in the buffer) of point." 6366 "Print the current line number (in the buffer) of point."
6410 (message "Line %d" 6372 (message "Line %d"
6411 (1+ (count-lines 1 (point))))))) 6373 (1+ (count-lines 1 (point)))))))
6412 @end group 6374 @end group
6413 @end smallexample 6375 @end smallexample
6414 6376
6415 The function has a documentation line and is interactive, as you would 6377 (In recent versions of GNU Emacs, the @code{what-line} function has
6416 expect. The next two lines use the functions @code{save-restriction} and 6378 been expanded to tell you your line number in a narrowed buffer as
6417 @code{widen}. 6379 well as your line number in a widened buffer. The recent version is
6380 more complex than the version shown here. If you feel adventurous,
6381 you might want to look at it after figuring out how this version
6382 works. The newer version uses a conditional to determine whether the
6383 buffer has been narrowed, and rather than use @code{beginning-of-line}
6384 to move point to the beginning of the current line, if need be, the
6385 function uses @code{(forward-line 0)}.)
6386
6387 The function as shown here has a documentation line and is
6388 interactive, as you would expect. The next two lines use the
6389 functions @code{save-restriction} and @code{widen}.
6418 6390
6419 The @code{save-restriction} special form notes whatever narrowing is in 6391 The @code{save-restriction} special form notes whatever narrowing is in
6420 effect, if any, in the current buffer and restores that narrowing after 6392 effect, if any, in the current buffer and restores that narrowing after
6421 the code in the body of the @code{save-restriction} has been evaluated. 6393 the code in the body of the @code{save-restriction} has been evaluated.
6422 6394
6458 @samp{%s}, or @samp{%c} to print arguments that follow the string. 6430 @samp{%s}, or @samp{%c} to print arguments that follow the string.
6459 @samp{%d} prints the argument as a decimal, so the message will say 6431 @samp{%d} prints the argument as a decimal, so the message will say
6460 something such as @samp{Line 243}. 6432 something such as @samp{Line 243}.
6461 6433
6462 @need 1200 6434 @need 1200
6435
6463 The number that is printed in place of the @samp{%d} is computed by the 6436 The number that is printed in place of the @samp{%d} is computed by the
6464 last line of the function: 6437 last line of the function:
6465 6438
6466 @smallexample 6439 @smallexample
6467 (1+ (count-lines 1 (point))) 6440 (1+ (count-lines 1 (point)))
6483 @node narrow Exercise, , what-line, Narrowing & Widening 6456 @node narrow Exercise, , what-line, Narrowing & Widening
6484 @section Exercise with Narrowing 6457 @section Exercise with Narrowing
6485 6458
6486 Write a function that will display the first 60 characters of the 6459 Write a function that will display the first 60 characters of the
6487 current buffer, even if you have narrowed the buffer to its latter 6460 current buffer, even if you have narrowed the buffer to its latter
6488 half so that the first line is inaccessible. Restore point, mark, 6461 half so that the first line is inaccessible. Restore point, mark, and
6489 and narrowing. For this exercise, you need to use 6462 narrowing. For this exercise, you need to use a whole potpourri of
6490 @code{save-restriction}, @code{widen}, @code{goto-char}, 6463 functions, including @code{save-restriction}, @code{widen},
6491 @code{point-min}, @code{buffer-substring}, @code{message}, and other 6464 @code{goto-char}, @code{point-min}, @code{message}, and
6492 functions, a whole potpourri. 6465 @code{buffer-substring}.
6466
6467 @cindex Properties, mention of @code{buffer-substring-no-properties}
6468 (@code{buffer-substring} is a previously unmentioned function you will
6469 have to investigate yourself; or perhaps you will have to use
6470 @code{buffer-substring-no-properties} @dots{}, yet another function
6471 and one that introduces text properties, a feature otherwise not
6472 discussed here. @xref{Text Properties, , Text Properties, elisp, The
6473 GNU Emacs Lisp Reference Manual}. Additionally, do you really need
6474 @code{goto-char} or @code{point-min}? Or can you write the function
6475 without them?)
6493 6476
6494 @node car cdr & cons, Cutting & Storing Text, Narrowing & Widening, Top 6477 @node car cdr & cons, Cutting & Storing Text, Narrowing & Widening, Top
6495 @comment node-name, next, previous, up 6478 @comment node-name, next, previous, up
6496 @chapter @code{car}, @code{cdr}, @code{cons}: Fundamental Functions 6479 @chapter @code{car}, @code{cdr}, @code{cons}: Fundamental Functions
6497 @findex car, @r{introduced} 6480 @findex car, @r{introduced}
6569 first item. Thus, while the @sc{car} of the list @code{'(rose violet 6552 first item. Thus, while the @sc{car} of the list @code{'(rose violet
6570 daisy buttercup)} is @code{rose}, the rest of the list, the value 6553 daisy buttercup)} is @code{rose}, the rest of the list, the value
6571 returned by the @code{cdr} function, is @code{(violet daisy 6554 returned by the @code{cdr} function, is @code{(violet daisy
6572 buttercup)}. 6555 buttercup)}.
6573 6556
6574 @need 1250 6557 @need 800
6575 You can see this by evaluating the following in the usual way: 6558 You can see this by evaluating the following in the usual way:
6576 6559
6577 @smallexample 6560 @smallexample
6578 (cdr '(rose violet daisy buttercup)) 6561 (cdr '(rose violet daisy buttercup))
6579 @end smallexample 6562 @end smallexample
7079 7062
7080 The @code{setcdr} function is similar to the @code{setcar} function, 7063 The @code{setcdr} function is similar to the @code{setcar} function,
7081 except that the function replaces the second and subsequent elements of 7064 except that the function replaces the second and subsequent elements of
7082 a list rather than the first element. 7065 a list rather than the first element.
7083 7066
7067 (To see how to change the last element of a list, look ahead to
7068 @ref{kill-new function, , The @code{kill-new} function}, which uses
7069 the @code{nthcdr} and @code{setcdr} functions.)
7070
7084 @need 1200 7071 @need 1200
7085 To see how this works, set the value of the variable to a list of 7072 To see how this works, set the value of the variable to a list of
7086 domesticated animals by evaluating the following expression: 7073 domesticated animals by evaluating the following expression:
7087 7074
7088 @smallexample 7075 @smallexample
7337 However, the version 19 implementation copies text from a read-only 7324 However, the version 19 implementation copies text from a read-only
7338 buffer only because of a mistake in the implementation of 7325 buffer only because of a mistake in the implementation of
7339 @code{interactive}. According to the documentation for 7326 @code{interactive}. According to the documentation for
7340 @code{interactive}, the asterisk, @samp{*}, should prevent the 7327 @code{interactive}, the asterisk, @samp{*}, should prevent the
7341 @code{zap-to-char} function from doing anything at all when the buffer 7328 @code{zap-to-char} function from doing anything at all when the buffer
7342 is read only. The function should not copy the text to the kill ring. 7329 is read only. In version 19, the function should not copy the text to
7343 It is a bug that it does. 7330 the kill ring. It is a bug that it does.
7344 7331
7345 In version 21, @code{interactive} is implemented correctly. So the 7332 In version 21, the function is designed to copy the text to the kill
7333 ring; moreover, @code{interactive} is implemented correctly. So the
7346 asterisk, @samp{*}, had to be removed from the interactive 7334 asterisk, @samp{*}, had to be removed from the interactive
7347 specification. If you insert an @samp{*} and evaluate the function 7335 specification. However, if you insert an @samp{*} yourself and
7348 definition, then the next time you run the @code{zap-to-char} function 7336 evaluate the function definition, then the next time you run the
7349 on a read-only buffer, you will not copy any text. 7337 @code{zap-to-char} function on a read-only buffer, you will not copy
7338 any text.
7350 7339
7351 That change aside, and a change to the documentation, the two versions 7340 That change aside, and a change to the documentation, the two versions
7352 of the @code{zap-to-char} function are identical. 7341 of the @code{zap-to-char} function are identical.
7353 7342
7354 Let us continue with the interactive specification. 7343 Let us continue with the interactive specification.
7558 @unnumberedsubsec The Complete @code{kill-region} Definition 7547 @unnumberedsubsec The Complete @code{kill-region} Definition
7559 @end ifnottex 7548 @end ifnottex
7560 7549
7561 @need 1200 7550 @need 1200
7562 We will go through the @code{condition-case} code in a moment. First, 7551 We will go through the @code{condition-case} code in a moment. First,
7563 let us look at the complete definition of @code{kill-region}, with 7552 let us look at the original definition of @code{kill-region}, with
7564 comments added: 7553 comments added (the newer definition has an optional third argument
7554 and is more complex):
7565 7555
7566 @c v 21 7556 @c v 21
7567 @smallexample 7557 @smallexample
7568 @group 7558 @group
7569 (defun kill-region (beg end) 7559 (defun kill-region (beg end)
8138 @end ifnottex 8128 @end ifnottex
8139 8129
8140 @need 1200 8130 @need 1200
8141 Here is the complete text of the version 21 @code{copy-region-as-kill} 8131 Here is the complete text of the version 21 @code{copy-region-as-kill}
8142 function: 8132 function:
8133
8134 @c !!! for no text properties, use buffer-substring-no-properties
8143 8135
8144 @smallexample 8136 @smallexample
8145 @group 8137 @group
8146 (defun copy-region-as-kill (beg end) 8138 (defun copy-region-as-kill (beg end)
8147 "Save the region as if killed, but don't kill it. 8139 "Save the region as if killed, but don't kill it.
8586 @dots{} It does this @var{N} times and returns the results. 8578 @dots{} It does this @var{N} times and returns the results.
8587 8579
8588 @findex setcdr, @r{example} 8580 @findex setcdr, @r{example}
8589 Thus, if we had a four element list that was supposed to be three 8581 Thus, if we had a four element list that was supposed to be three
8590 elements long, we could set the @sc{cdr} of the next to last element 8582 elements long, we could set the @sc{cdr} of the next to last element
8591 to @code{nil}, and thereby shorten the list. 8583 to @code{nil}, and thereby shorten the list. (If you sent the last
8592 8584 element to some other value than @code{nil}, which you could do, then
8593 You can see this by evaluating the following three expressions in turn. 8585 you would not have shortened the list.)
8594 First set the value of @code{trees} to @code{(maple oak pine birch)}, 8586
8595 then set the @sc{cdr} of its second @sc{cdr} to @code{nil} and then 8587 You can see shortening by evaluating the following three expressions
8596 find the value of @code{trees}: 8588 in turn. First set the value of @code{trees} to @code{(maple oak pine
8589 birch)}, then set the @sc{cdr} of its second @sc{cdr} to @code{nil}
8590 and then find the value of @code{trees}:
8597 8591
8598 @smallexample 8592 @smallexample
8599 @group 8593 @group
8600 (setq trees '(maple oak pine birch)) 8594 (setq trees '(maple oak pine birch))
8601 @result{} (maple oak pine birch) 8595 @result{} (maple oak pine birch)
8716 bringing back text that has been cut out of the buffer---the yank 8710 bringing back text that has been cut out of the buffer---the yank
8717 commands. However, before discussing the yank commands, it is better 8711 commands. However, before discussing the yank commands, it is better
8718 to learn how lists are implemented in a computer. This will make 8712 to learn how lists are implemented in a computer. This will make
8719 clear such mysteries as the use of the term `pointer'. 8713 clear such mysteries as the use of the term `pointer'.
8720 8714
8715 @need 1250
8721 @node cons & search-fwd Review, search Exercises, copy-region-as-kill, Cutting & Storing Text 8716 @node cons & search-fwd Review, search Exercises, copy-region-as-kill, Cutting & Storing Text
8722 @comment node-name, next, previous, up 8717 @comment node-name, next, previous, up
8723 @section Review 8718 @section Review
8724 8719
8725 Here is a brief summary of some recently introduced functions. 8720 Here is a brief summary of some recently introduced functions.
8841 Optionally, how many times to repeat the search; if negative, the 8836 Optionally, how many times to repeat the search; if negative, the
8842 search goes backwards. 8837 search goes backwards.
8843 @end enumerate 8838 @end enumerate
8844 8839
8845 @item kill-region 8840 @item kill-region
8846 @itemx delete-region 8841 @itemx delete-and-extract-region
8847 @itemx copy-region-as-kill 8842 @itemx copy-region-as-kill
8848 8843
8849 @code{kill-region} cuts the text between point and mark from the 8844 @code{kill-region} cuts the text between point and mark from the
8850 buffer and stores that text in the kill ring, so you can get it back 8845 buffer and stores that text in the kill ring, so you can get it back
8851 by yanking. 8846 by yanking.
11521 11516
11522 @c comma in printed title causes problem in Info cross reference 11517 @c comma in printed title causes problem in Info cross reference
11523 @item 11518 @item
11524 Write a function for Texinfo mode that creates an index entry at the 11519 Write a function for Texinfo mode that creates an index entry at the
11525 beginning of a paragraph for every @samp{@@dfn} within the paragraph. 11520 beginning of a paragraph for every @samp{@@dfn} within the paragraph.
11526 (In a Texinfo file, @samp{@@dfn} marks a definition. For more 11521 (In a Texinfo file, @samp{@@dfn} marks a definition. This book is
11527 information, see 11522 written in Texinfo.)
11523
11524 Many of the functions you will need are described in two of the
11525 previous chapters, @ref{Cutting & Storing Text, , Cutting and Storing
11526 Text}, and @ref{Yanking, , Yanking Text Back}. If you use
11527 @code{forward-paragraph} to put the index entry at the beginning of
11528 the paragraph, you will have to use @w{@kbd{C-h f}}
11529 (@code{describe-function}) to find out how to make the command go
11530 backwards.
11531
11532 For more information, see
11528 @ifinfo 11533 @ifinfo
11529 @ref{Indicating, , Indicating Definitions, texinfo}.) 11534 @ref{Indicating, , Indicating Definitions, texinfo}.
11530 @end ifinfo 11535 @end ifinfo
11531 @ifhtml 11536 @ifhtml
11532 @ref{Indicating, , Indicating, texinfo, Texinfo Manual}.) 11537 @ref{Indicating, , Indicating, texinfo, Texinfo Manual}, which goes to
11538 a Texinfo manual in the current directory. Or, if you are on the
11539 Internet, see
11540 @uref{http://www.gnu.org/manual/texinfo-4.6/html_node/Indicating.html}
11533 @end ifhtml 11541 @end ifhtml
11534 @iftex 11542 @iftex
11535 ``Indicating Definitions, Commands, etc.'' in @cite{Texinfo, The GNU 11543 ``Indicating Definitions, Commands, etc.'' in @cite{Texinfo, The GNU
11536 Documentation Format}.) 11544 Documentation Format}.
11537 @end iftex 11545 @end iftex
11538 @end itemize 11546 @end itemize
11539 11547
11540 @node Regexp Search, Counting Words, Loops & Recursion, Top 11548 @node Regexp Search, Counting Words, Loops & Recursion, Top
11541 @comment node-name, next, previous, up 11549 @comment node-name, next, previous, up
14703 (sort 14711 (sort
14704 (recursive-lengths-list-many-files 14712 (recursive-lengths-list-many-files
14705 '("../lisp/macros.el" 14713 '("../lisp/macros.el"
14706 "../lisp/mailalias.el" 14714 "../lisp/mailalias.el"
14707 "../lisp/makesum.el")) 14715 "../lisp/makesum.el"))
14708 '< 14716 '<)
14709 @end group 14717 @end group
14710 @end smallexample 14718 @end smallexample
14711 14719
14712 @need 800 14720 @need 800
14713 @noindent 14721 @noindent
16095 The fourth and subsequent arguments to @code{defcustom} specify types 16103 The fourth and subsequent arguments to @code{defcustom} specify types
16096 and options; these are not featured in @code{defvar}. (These 16104 and options; these are not featured in @code{defvar}. (These
16097 arguments are optional.) 16105 arguments are optional.)
16098 16106
16099 Each of these arguments consists of a keyword followed by a value. 16107 Each of these arguments consists of a keyword followed by a value.
16100 Each keyword starts with the character @code{:}. 16108 Each keyword starts with the colon character @samp{:}.
16101 16109
16102 @need 1250 16110 @need 1250
16103 For example, the customizable user option variable 16111 For example, the customizable user option variable
16104 @code{text-mode-hook} looks like this: 16112 @code{text-mode-hook} looks like this:
16105 16113
16178 In spite of the warning, you certainly may edit, cut, and paste the 16186 In spite of the warning, you certainly may edit, cut, and paste the
16179 expression! I do all time. The purpose of the warning is to scare 16187 expression! I do all time. The purpose of the warning is to scare
16180 those who do not know what they are doing, so they do not 16188 those who do not know what they are doing, so they do not
16181 inadvertently generate an error. 16189 inadvertently generate an error.
16182 16190
16183 The @code{custom-set-variables} works somewhat differently than a 16191 The @code{custom-set-variables} function works somewhat differently
16184 @code{setq}. While I have never learned the differences, I do modify 16192 than a @code{setq}. While I have never learned the differences, I do
16185 the @code{custom-set-variables} expressions in my @file{.emacs} file 16193 modify the @code{custom-set-variables} expressions in my @file{.emacs}
16186 by hand: I make the changes in what appears to me to be a reasonable 16194 file by hand: I make the changes in what appears to me to be a
16187 manner and have not had any problems. Others prefer to use the 16195 reasonable manner and have not had any problems. Others prefer to use
16188 Customization command and let Emacs do the work for them. 16196 the Customization command and let Emacs do the work for them.
16189 16197
16190 Another @code{custom-set-@dots{}} function is @code{custom-set-faces}. 16198 Another @code{custom-set-@dots{}} function is @code{custom-set-faces}.
16191 This function sets the various font faces. Over time, I have set a 16199 This function sets the various font faces. Over time, I have set a
16192 considerable number of faces. Some of the time, I re-set them using 16200 considerable number of faces. Some of the time, I re-set them using
16193 @code{customize}; other times, I simply edit the 16201 @code{customize}; other times, I simply edit the
16247 16255
16248 The first part of the file consists of comments: reminders to myself. 16256 The first part of the file consists of comments: reminders to myself.
16249 By now, of course, I remember these things, but when I started, I did 16257 By now, of course, I remember these things, but when I started, I did
16250 not. 16258 not.
16251 16259
16260 @need 1200
16252 @smallexample 16261 @smallexample
16253 @group 16262 @group
16254 ;;;; Bob's .emacs file 16263 ;;;; Bob's .emacs file
16255 ; Robert J. Chassell 16264 ; Robert J. Chassell
16256 ; 26 September 1985 16265 ; 26 September 1985
16697 @c findex load 16706 @c findex load
16698 16707
16699 Many people in the GNU Emacs community have written extensions to 16708 Many people in the GNU Emacs community have written extensions to
16700 Emacs. As time goes by, these extensions are often included in new 16709 Emacs. As time goes by, these extensions are often included in new
16701 releases. For example, the Calendar and Diary packages are now part 16710 releases. For example, the Calendar and Diary packages are now part
16702 of the standard GNU Emacs. 16711 of the standard GNU Emacs, as is Calc.
16703
16704 (Calc, which I consider a vital part of Emacs, would be part of the
16705 standard distribution except that it was so large it was packaged
16706 separately and no one has changed that.)
16707 16712
16708 You can use a @code{load} command to evaluate a complete file and 16713 You can use a @code{load} command to evaluate a complete file and
16709 thereby install all the functions and variables in the file into Emacs. 16714 thereby install all the functions and variables in the file into Emacs.
16710 For example: 16715 For example:
16711 16716
17079 @group 17084 @group
17080 (setq x-pointer-shape (string-to-int mpointer)) 17085 (setq x-pointer-shape (string-to-int mpointer))
17081 (set-mouse-color "white")) 17086 (set-mouse-color "white"))
17082 @end group 17087 @end group
17083 @end smallexample 17088 @end smallexample
17089
17090 @item
17091 Convert @kbd{@key{CTL}-h} into @key{DEL} and @key{DEL}
17092 into @kbd{@key{CTL}-h}.@*
17093 (Some olders keyboards needed this, although I have not seen the
17094 problem recently.)
17095
17096 @smallexample
17097 @group
17098 ;; Translate `C-h' to <DEL>.
17099 ; (keyboard-translate ?\C-h ?\C-?)
17100
17101 ;; Translate <DEL> to `C-h'.
17102 (keyboard-translate ?\C-? ?\C-h)
17103 @end group
17104 @end smallexample
17105
17106 @item Turn off a blinking cursor!
17107
17108 @smallexample
17109 @group
17110 (if (fboundp 'blink-cursor-mode)
17111 (blink-cursor-mode -1))
17112 @end group
17113 @end smallexample
17114
17115 @item Ignore case when using `grep'@*
17116 @samp{-n}@w{ } Prefix each line of output with line number@*
17117 @samp{-i}@w{ } Ignore case distinctions@*
17118 @samp{-e}@w{ } Protect patterns beginning with a hyphen character, @samp{-}
17119
17120 @smallexample
17121 (setq grep-command "grep -n -i -e ")
17122 @end smallexample
17123
17124 @item Automatically uncompress compressed files when visiting them
17125
17126 @smallexample
17127 (load "uncompress")
17128 @end smallexample
17129
17130 @item Find an existing buffer, even if it has a different name@*
17131 This avoids problems with symbolic links.
17132
17133 @smallexample
17134 (setq find-file-existing-other-name t)
17135 @end smallexample
17136
17137 @item Set your language environment and default input method
17138
17139 @smallexample
17140 @group
17141 (set-language-environment "latin-1")
17142 ;; Remember you can enable or disable multilingual text input
17143 ;; with the @code{toggle-input-method'} (@kbd{C-\}) command
17144 (setq default-input-method "latin-1-prefix")
17145 @end group
17146 @end smallexample
17147
17148 If you want to write with Chinese `GB' characters, set this instead:
17149
17150 @smallexample
17151 @group
17152 (set-language-environment "Chinese-GB")
17153 (setq default-input-method "chinese-tonepy")
17154 @end group
17155 @end smallexample
17084 @end itemize 17156 @end itemize
17157
17158 @subsubheading Fixing Unpleasant Key Bindings
17159 @cindex Key bindings, fixing
17160 @cindex Bindings, key, fixing unpleasant
17161
17162 Some systems bind keys unpleasantly. Sometimes, for example, the
17163 @key{CTL} key appears in an awkward spot rather than at the far left
17164 of the home row.
17165
17166 Usually, when people fix these sorts of keybindings, they do not
17167 change their @file{~/.emacs} file. Instead, they bind the proper keys
17168 on their consoles with the @code{loadkeys} or @code{install-keymap}
17169 commands in their boot script and then include @code{xmodmap} commands
17170 in their @file{.xinitrc} or @file{.Xsession} file for X Windows.
17171
17172 @need 1250
17173 @noindent
17174 For a boot script:
17175
17176 @smallexample
17177 @group
17178 loadkeys /usr/share/keymaps/i386/qwerty/emacs2.kmap.gz
17179
17180 @exdent or
17181
17182 install-keymap emacs2
17183 @end group
17184 @end smallexample
17185
17186 @need 1250
17187 @noindent
17188 For a @file{.xinitrc} or @file{.Xsession} file when the @key{Caps
17189 Lock} key is at the far left of the home row:
17190
17191 @smallexample
17192 @group
17193 # Bind the key labeled `Caps Lock' to `Control'
17194 # (Such a broken user interface suggests that keyboard manufacturers
17195 # think that computers are typewriters from 1885.)
17196
17197 xmodmap -e "clear Lock"
17198 xmodmap -e "add Control = Caps_Lock"
17199 @end group
17200 @end smallexample
17201
17202 @need 1250
17203 @noindent
17204 In a @file{.xinitrc} or @file{.Xsession} file, to convert an @key{ALT}
17205 key to a @key{META} key:
17206
17207 @smallexample
17208 @group
17209 # Some ill designed keyboards have a key labeled ALT and no Meta
17210 xmodmap -e "keysym Alt_L = Meta_L Alt_L"
17211 @end group
17212 @end smallexample
17085 17213
17086 @node Mode Line, , Miscellaneous, Emacs Initialization 17214 @node Mode Line, , Miscellaneous, Emacs Initialization
17087 @section A Modified Mode Line 17215 @section A Modified Mode Line
17088 @vindex default-mode-line-format 17216 @vindex default-mode-line-format
17089 @cindex Mode line format 17217 @cindex Mode line format
17158 @code{mode-line-modified} is a variable that tells whether the buffer 17286 @code{mode-line-modified} is a variable that tells whether the buffer
17159 has been modified, @code{mode-name} tells the name of the mode, and so 17287 has been modified, @code{mode-name} tells the name of the mode, and so
17160 on. However, the format looks complicated because of two features we 17288 on. However, the format looks complicated because of two features we
17161 have not discussed. 17289 have not discussed.
17162 17290
17291 @cindex Properties, in mode line example
17163 The first string in the mode line is a dash or hyphen, @samp{-}. In 17292 The first string in the mode line is a dash or hyphen, @samp{-}. In
17164 the old days, it would have been specified simply as @code{"-"}. But 17293 the old days, it would have been specified simply as @code{"-"}. But
17165 nowadays, Emacs can add properties to a string, such as highlighting 17294 nowadays, Emacs can add properties to a string, such as highlighting
17166 or, as in this case, a help feature. If you place your mouse cursor 17295 or, as in this case, a help feature. If you place your mouse cursor
17167 over the hyphen, some help information appears (By default, you must 17296 over the hyphen, some help information appears (By default, you must
17168 wait one second before the information appears. You can change that 17297 wait one second before the information appears. You can change that
17169 timing by changing the value of @code{tooltip-delay}.) 17298 timing by changing the value of @code{tooltip-delay}.)
17170 17299
17171 @need 1000 17300 @need 1000
17172 The new string format has a special syntax: 17301 The new string format has a special syntax:
17185 the range. It consists of a property list, a 17314 the range. It consists of a property list, a
17186 property name, in this case, @samp{help-echo}, followed by a value, in this 17315 property name, in this case, @samp{help-echo}, followed by a value, in this
17187 case, a string. The second, third, and fourth elements of this new 17316 case, a string. The second, third, and fourth elements of this new
17188 string format can be repeated. 17317 string format can be repeated.
17189 17318
17190 @xref{Text Props and Strings, , Text Properties in String, elisp, The 17319 @xref{Text Properties, , Text Properties, elisp, The GNU Emacs Lisp
17191 GNU Emacs Lisp Reference Manual}, and see @ref{Mode Line Format, , Mode 17320 Reference Manual}, and see @ref{Mode Line Format, , Mode Line Format,
17192 Line Format, elisp, The GNU Emacs Lisp Reference Manual}, for more 17321 elisp, The GNU Emacs Lisp Reference Manual}, for more information.
17193 information.
17194 17322
17195 @code{mode-line-buffer-identification} 17323 @code{mode-line-buffer-identification}
17196 displays the current buffer name. It is a list 17324 displays the current buffer name. It is a list
17197 beginning @code{(#("%12b" 0 4 @dots{}}. 17325 beginning @code{(#("%12b" 0 4 @dots{}}.
17198 The @code{#(} begins the list. 17326 The @code{#(} begins the list.
17493 call-interactively(eval-last-sexp) 17621 call-interactively(eval-last-sexp)
17494 ---------- Buffer: *Backtrace* ---------- 17622 ---------- Buffer: *Backtrace* ----------
17495 @end group 17623 @end group
17496 @end smallexample 17624 @end smallexample
17497 17625
17626 @need 1500
17498 @noindent 17627 @noindent
17499 Finally, after you type @kbd{d} two more times, Emacs will reach the 17628 Finally, after you type @kbd{d} two more times, Emacs will reach the
17500 error, and the top two lines of the @file{*Backtrace*} buffer will look 17629 error, and the top two lines of the @file{*Backtrace*} buffer will look
17501 like this: 17630 like this:
17502 17631
17571 quickly until reaching a @dfn{breakpoint} where execution stops. 17700 quickly until reaching a @dfn{breakpoint} where execution stops.
17572 17701
17573 Edebug is described in @ref{edebug, , Edebug, elisp, The GNU Emacs 17702 Edebug is described in @ref{edebug, , Edebug, elisp, The GNU Emacs
17574 Lisp Reference Manual}. 17703 Lisp Reference Manual}.
17575 17704
17705 @need 1250
17576 Here is a bugged function definition for @code{triangle-recursively}. 17706 Here is a bugged function definition for @code{triangle-recursively}.
17577 @xref{Recursive triangle function, , Recursion in place of a counter}, 17707 @xref{Recursive triangle function, , Recursion in place of a counter},
17578 for a review of it. 17708 for a review of it.
17579 17709
17580 @smallexample 17710 @smallexample
17658 Result: 3 = C-c 17788 Result: 3 = C-c
17659 @end smallexample 17789 @end smallexample
17660 17790
17661 @noindent 17791 @noindent
17662 This means the value of @code{number} is 3, which is @sc{ascii} 17792 This means the value of @code{number} is 3, which is @sc{ascii}
17663 `control-c' (the third letter of the alphabet). 17793 `control-c' (the third letter of the alphabet, in case you need to
17794 know this information).
17664 17795
17665 You can continue moving through the code until you reach the line with 17796 You can continue moving through the code until you reach the line with
17666 the error. Before evaluation, that line looks like this: 17797 the error. Before evaluation, that line looks like this:
17667 17798
17668 @smallexample 17799 @smallexample
17988 18119
17989 @menu 18120 @menu
17990 * rotate-yank-pointer:: Move a pointer along a list and around. 18121 * rotate-yank-pointer:: Move a pointer along a list and around.
17991 * yank:: Paste a copy of a clipped element. 18122 * yank:: Paste a copy of a clipped element.
17992 * yank-pop:: Insert first element pointed to. 18123 * yank-pop:: Insert first element pointed to.
18124 * ring file::
17993 @end menu 18125 @end menu
17994 18126
17995 @node rotate-yank-pointer, yank, Kill Ring, Kill Ring 18127 @node rotate-yank-pointer, yank, Kill Ring, Kill Ring
17996 @comment node-name, next, previous, up 18128 @comment node-name, next, previous, up
17997 @appendixsec The @code{rotate-yank-pointer} Function 18129 @appendixsec The @code{rotate-yank-pointer} Function
18306 @end smallexample 18438 @end smallexample
18307 18439
18308 @noindent 18440 @noindent
18309 will be 1. 18441 will be 1.
18310 18442
18443 @need 1200
18311 Consequently, the argument to @code{nthcdr} will be found as the result of 18444 Consequently, the argument to @code{nthcdr} will be found as the result of
18312 the expression 18445 the expression
18313 18446
18314 @smallexample 18447 @smallexample
18315 (% 1 length) 18448 (% 1 length)
18382 18515
18383 @noindent 18516 @noindent
18384 is 1. (I just checked this by placing the cursor after the expression 18517 is 1. (I just checked this by placing the cursor after the expression
18385 and typing @kbd{C-x C-e}. Indeed, 1 is printed in the echo area.) 18518 and typing @kbd{C-x C-e}. Indeed, 1 is printed in the echo area.)
18386 18519
18520 @need 2000
18387 @node rotate-yk-ptr remainder, kill-rng-yk-ptr last elt, Remainder Function, rotate-yk-ptr body 18521 @node rotate-yk-ptr remainder, kill-rng-yk-ptr last elt, Remainder Function, rotate-yk-ptr body
18388 @unnumberedsubsubsec Using @code{%} in @code{rotate-yank-pointer} 18522 @unnumberedsubsubsec Using @code{%} in @code{rotate-yank-pointer}
18389 18523
18390 When the @code{kill-ring-yank-pointer} points to the 18524 When the @code{kill-ring-yank-pointer} points to the
18391 beginning of the kill ring, and the argument passed to 18525 beginning of the kill ring, and the argument passed to
18680 simplification for writing the program. You don't need to jump back 18814 simplification for writing the program. You don't need to jump back
18681 towards the beginning of the kill ring more than one place at a time 18815 towards the beginning of the kill ring more than one place at a time
18682 and doing this is easier than writing a function to determine the 18816 and doing this is easier than writing a function to determine the
18683 magnitude of the number that follows the minus sign. 18817 magnitude of the number that follows the minus sign.
18684 18818
18685 @node yank-pop, , yank, Kill Ring 18819 @node yank-pop, ring file, yank, Kill Ring
18686 @comment node-name, next, previous, up 18820 @comment node-name, next, previous, up
18687 @appendixsec @code{yank-pop} 18821 @appendixsec @code{yank-pop}
18688 @findex yank-pop 18822 @findex yank-pop
18689 18823
18690 After understanding @code{yank}, the @code{yank-pop} function is easy. 18824 After understanding @code{yank}, the @code{yank-pop} function is easy.
18727 inserted. This leaves point after the new text. If in the previous 18861 inserted. This leaves point after the new text. If in the previous
18728 yank, point was left before the inserted text, point and mark are now 18862 yank, point was left before the inserted text, point and mark are now
18729 exchanged so point is again left in front of the newly inserted text. 18863 exchanged so point is again left in front of the newly inserted text.
18730 That is all there is to it! 18864 That is all there is to it!
18731 18865
18732 @node Full Graph, GNU Free Documentation License, Kill Ring, Top 18866 @node ring file, , yank-pop, Kill Ring
18867 @comment node-name, next, previous, up
18868 @appendixsec The @file{ring.el} File
18869 @cindex @file{ring.el} file
18870
18871 Interestingly, GNU Emacs posses a file called @file{ring.el} that
18872 provides many of the features we just discussed. But functions such
18873 as @code{kill-ring-yank-pointer} do not use this library, possibly
18874 because they were written earlier.
18875
18876 @node Full Graph, Free Software and Free Manuals, Kill Ring, Top
18733 @appendix A Graph with Labelled Axes 18877 @appendix A Graph with Labelled Axes
18734 18878
18735 Printed axes help you understand a graph. They convey scale. In an 18879 Printed axes help you understand a graph. They convey scale. In an
18736 earlier chapter (@pxref{Readying a Graph, , Readying a Graph}), we 18880 earlier chapter (@pxref{Readying a Graph, , Readying a Graph}), we
18737 wrote the code to print the body of a graph. Here we write the code 18881 wrote the code to print the body of a graph. Here we write the code
18873 @end smallexample 19017 @end smallexample
18874 19018
18875 @noindent 19019 @noindent
18876 As we shall see, this expression is not quite right. 19020 As we shall see, this expression is not quite right.
18877 19021
19022 @need 2000
18878 @node print-Y-axis, print-X-axis, print-graph Varlist, Full Graph 19023 @node print-Y-axis, print-X-axis, print-graph Varlist, Full Graph
18879 @comment node-name, next, previous, up 19024 @comment node-name, next, previous, up
18880 @appendixsec The @code{print-Y-axis} Function 19025 @appendixsec The @code{print-Y-axis} Function
18881 @cindex Axis, print vertical 19026 @cindex Axis, print vertical
18882 @cindex Y axis printing 19027 @cindex Y axis printing
18948 19093
18949 As usual in cases like this, a complex problem becomes simpler if it is 19094 As usual in cases like this, a complex problem becomes simpler if it is
18950 divided into several smaller problems. 19095 divided into several smaller problems.
18951 19096
18952 First, consider the case when the highest value of the graph is an 19097 First, consider the case when the highest value of the graph is an
18953 integral multiple of five---when it is 5, 10, 15 ,or some higher 19098 integral multiple of five---when it is 5, 10, 15, or some higher
18954 multiple of five. We can use this value as the Y axis height. 19099 multiple of five. We can use this value as the Y axis height.
18955 19100
18956 A fairly simply way to determine whether a number is a multiple of 19101 A fairly simply way to determine whether a number is a multiple of
18957 five is to divide it by five and see if the division results in a 19102 five is to divide it by five and see if the division results in a
18958 remainder. If there is no remainder, the number is a multiple of 19103 remainder. If there is no remainder, the number is a multiple of
19248 @code{Y-axis-label-spacing}. If it is, we construct a numbered label 19393 @code{Y-axis-label-spacing}. If it is, we construct a numbered label
19249 using the @code{Y-axis-element} function; if not, we construct a 19394 using the @code{Y-axis-element} function; if not, we construct a
19250 blank label using the @code{make-string} function. The base line 19395 blank label using the @code{make-string} function. The base line
19251 consists of the number one followed by a tic mark. 19396 consists of the number one followed by a tic mark.
19252 19397
19398 @need 2000
19253 @node print-Y-axis Penultimate, , Y-axis-column, print-Y-axis 19399 @node print-Y-axis Penultimate, , Y-axis-column, print-Y-axis
19254 @appendixsubsec The Not Quite Final Version of @code{print-Y-axis} 19400 @appendixsubsec The Not Quite Final Version of @code{print-Y-axis}
19255 19401
19256 The list constructed by the @code{Y-axis-column} function is passed to 19402 The list constructed by the @code{Y-axis-column} function is passed to
19257 the @code{print-Y-axis} function, which inserts the list as a column. 19403 the @code{print-Y-axis} function, which inserts the list as a column.
19323 Emacs will print labels vertically, the top one being 19469 Emacs will print labels vertically, the top one being
19324 @w{@samp{10 -@w{ }}}. (The @code{print-graph} function 19470 @w{@samp{10 -@w{ }}}. (The @code{print-graph} function
19325 will pass the value of @code{height-of-top-line}, which 19471 will pass the value of @code{height-of-top-line}, which
19326 in this case would end up as 15.) 19472 in this case would end up as 15.)
19327 19473
19474 @need 2000
19328 @node print-X-axis, Print Whole Graph, print-Y-axis, Full Graph 19475 @node print-X-axis, Print Whole Graph, print-Y-axis, Full Graph
19329 @appendixsec The @code{print-X-axis} Function 19476 @appendixsec The @code{print-X-axis} Function
19330 @cindex Axis, print horizontal 19477 @cindex Axis, print horizontal
19331 @cindex X axis printing 19478 @cindex X axis printing
19332 @cindex Print horizontal axis 19479 @cindex Print horizontal axis
19665 Press @key{RET} to evaluate the expression. 19812 Press @key{RET} to evaluate the expression.
19666 @end enumerate 19813 @end enumerate
19667 19814
19668 @need 1250 19815 @need 1250
19669 Emacs will print the horizontal axis like this: 19816 Emacs will print the horizontal axis like this:
19817 @sp 1
19670 19818
19671 @smallexample 19819 @smallexample
19672 @group 19820 @group
19673 | | | | | 19821 | | | | |
19674 1 5 10 15 20 19822 1 5 10 15 20
19919 | | | | 20067 | | | |
19920 1 5 10 15 20068 1 5 10 15
19921 @end group 20069 @end group
19922 @end smallexample 20070 @end smallexample
19923 20071
20072 @need 1200
19924 On the other hand, if you pass @code{print-graph} a 20073 On the other hand, if you pass @code{print-graph} a
19925 @code{vertical-step} value of 2, by evaluating this expression: 20074 @code{vertical-step} value of 2, by evaluating this expression:
19926 20075
19927 @smallexample 20076 @smallexample
19928 (print-graph '(3 2 5 6 7 5 3 4 6 4 3 2 1) 2) 20077 (print-graph '(3 2 5 6 7 5 3 4 6 4 3 2 1) 2)
20002 top-of-ranges)) 20151 top-of-ranges))
20003 @end group 20152 @end group
20004 @end smallexample 20153 @end smallexample
20005 20154
20006 @noindent 20155 @noindent
20007 On my machine, this takes about an hour. It looks though 303 Lisp 20156 On my old machine, this took about an hour. It looked though 303 Lisp
20008 files in my copy of Emacs version 19.23. After all that computing, 20157 files in my copy of Emacs version 19.23. After all that computing,
20009 the @code{list-for-graph} has this value: 20158 the @code{list-for-graph} had this value:
20010 20159
20011 @smallexample 20160 @smallexample
20012 @group 20161 @group
20013 (537 1027 955 785 594 483 349 292 224 199 166 120 116 99 20162 (537 1027 955 785 594 483 349 292 224 199 166 120 116 99
20014 90 80 67 48 52 45 41 33 28 26 25 20 12 28 11 13 220) 20163 90 80 67 48 52 45 41 33 28 26 25 20 12 28 11 13 220)
20015 @end group 20164 @end group
20016 @end smallexample 20165 @end smallexample
20017 20166
20018 @noindent 20167 @noindent
20019 This means that my copy of Emacs has 537 function definitions with 20168 This means that my copy of Emacs had 537 function definitions with
20020 fewer than 10 words or symbols in them, 1,027 function definitions 20169 fewer than 10 words or symbols in them, 1,027 function definitions
20021 with 10 to 19 words or symbols in them, 955 function definitions with 20170 with 10 to 19 words or symbols in them, 955 function definitions with
20022 20 to 29 words or symbols in them, and so on. 20171 20 to 29 words or symbols in them, and so on.
20023 20172
20024 Clearly, just by looking at this list we can see that most function 20173 Clearly, just by looking at this list we can see that most function
20062 20211
20063 @noindent 20212 @noindent
20064 is a function definition that says `return the value resulting from 20213 is a function definition that says `return the value resulting from
20065 dividing whatever is passed to me as @code{arg} by 50'. 20214 dividing whatever is passed to me as @code{arg} by 50'.
20066 20215
20216 @need 1200
20067 Earlier, for example, we had a function @code{multiply-by-seven}; it 20217 Earlier, for example, we had a function @code{multiply-by-seven}; it
20068 multiplied its argument by 7. This function is similar, except it 20218 multiplied its argument by 7. This function is similar, except it
20069 divides its argument by 50; and, it has no name. The anonymous 20219 divides its argument by 50; and, it has no name. The anonymous
20070 equivalent of @code{multiply-by-seven} is: 20220 equivalent of @code{multiply-by-seven} is:
20071 20221
20990 @node Final printed graph, , Another Bug, Print Whole Graph 21140 @node Final printed graph, , Another Bug, Print Whole Graph
20991 @appendixsubsec The Printed Graph 21141 @appendixsubsec The Printed Graph
20992 21142
20993 When made and installed, you can call the @code{print-graph} command 21143 When made and installed, you can call the @code{print-graph} command
20994 like this: 21144 like this:
21145 @sp 1
20995 21146
20996 @smallexample 21147 @smallexample
20997 @group 21148 @group
20998 (print-graph fiftieth-list-for-graph 50 10) 21149 (print-graph fiftieth-list-for-graph 50 10)
20999 @end group 21150 @end group
21000 @end smallexample 21151 @end smallexample
21001 21152 @sp 1
21153
21154 @noindent
21002 Here is the graph: 21155 Here is the graph:
21003
21004 @sp 2 21156 @sp 2
21005 21157
21006 @smallexample 21158 @smallexample
21007 @group 21159 @group
21008 1000 - * 21160 1000 - *
21030 @end group 21182 @end group
21031 @end smallexample 21183 @end smallexample
21032 21184
21033 @sp 2 21185 @sp 2
21034 21186
21187 @noindent
21035 The largest group of functions contain 10 -- 19 words and symbols each. 21188 The largest group of functions contain 10 -- 19 words and symbols each.
21036 21189
21037 @node GNU Free Documentation License, Index, Full Graph, Top 21190 @node Free Software and Free Manuals, GNU Free Documentation License, Full Graph, Top
21191 @appendix Free Software and Free Manuals
21192
21193 @strong{by Richard M. Stallman}
21194 @sp 1
21195
21196 The biggest deficiency in free operating systems is not in the
21197 software---it is the lack of good free manuals that we can include in
21198 these systems. Many of our most important programs do not come with
21199 full manuals. Documentation is an essential part of any software
21200 package; when an important free software package does not come with a
21201 free manual, that is a major gap. We have many such gaps today.
21202
21203 Once upon a time, many years ago, I thought I would learn Perl. I got
21204 a copy of a free manual, but I found it hard to read. When I asked
21205 Perl users about alternatives, they told me that there were better
21206 introductory manuals---but those were not free.
21207
21208 Why was this? The authors of the good manuals had written them for
21209 O'Reilly Associates, which published them with restrictive terms---no
21210 copying, no modification, source files not available---which exclude
21211 them from the free software community.
21212
21213 That wasn't the first time this sort of thing has happened, and (to
21214 our community's great loss) it was far from the last. Proprietary
21215 manual publishers have enticed a great many authors to restrict their
21216 manuals since then. Many times I have heard a GNU user eagerly tell me
21217 about a manual that he is writing, with which he expects to help the
21218 GNU project---and then had my hopes dashed, as he proceeded to explain
21219 that he had signed a contract with a publisher that would restrict it
21220 so that we cannot use it.
21221
21222 Given that writing good English is a rare skill among programmers, we
21223 can ill afford to lose manuals this way.
21224
21225 @c (texinfo)uref
21226 (The Free Software Foundation
21227 @uref{http://www.gnu.org/doc/doc.html#DescriptionsOfGNUDocumentation, ,
21228 sells printed copies} of free @uref{http://www.gnu.org/doc/doc.html,
21229 GNU manuals}, too.)
21230
21231 Free documentation, like free software, is a matter of freedom, not
21232 price. The problem with these manuals was not that O'Reilly Associates
21233 charged a price for printed copies---that in itself is fine. (The Free
21234 Software Foundation sells printed copies of free GNU manuals, too.)
21235 But GNU manuals are available in source code form, while these manuals
21236 are available only on paper. GNU manuals come with permission to copy
21237 and modify; the Perl manuals do not. These restrictions are the
21238 problems.
21239
21240 The criterion for a free manual is pretty much the same as for free
21241 software: it is a matter of giving all users certain
21242 freedoms. Redistribution (including commercial redistribution) must be
21243 permitted, so that the manual can accompany every copy of the program,
21244 on-line or on paper. Permission for modification is crucial too.
21245
21246 As a general rule, I don't believe that it is essential for people to
21247 have permission to modify all sorts of articles and books. The issues
21248 for writings are not necessarily the same as those for software. For
21249 example, I don't think you or I are obliged to give permission to
21250 modify articles like this one, which describe our actions and our
21251 views.
21252
21253 But there is a particular reason why the freedom to modify is crucial
21254 for documentation for free software. When people exercise their right
21255 to modify the software, and add or change its features, if they are
21256 conscientious they will change the manual too---so they can provide
21257 accurate and usable documentation with the modified program. A manual
21258 which forbids programmers to be conscientious and finish the job, or
21259 more precisely requires them to write a new manual from scratch if
21260 they change the program, does not fill our community's needs.
21261
21262 While a blanket prohibition on modification is unacceptable, some
21263 kinds of limits on the method of modification pose no problem. For
21264 example, requirements to preserve the original author's copyright
21265 notice, the distribution terms, or the list of authors, are ok. It is
21266 also no problem to require modified versions to include notice that
21267 they were modified, even to have entire sections that may not be
21268 deleted or changed, as long as these sections deal with nontechnical
21269 topics. (Some GNU manuals have them.)
21270
21271 These kinds of restrictions are not a problem because, as a practical
21272 matter, they don't stop the conscientious programmer from adapting the
21273 manual to fit the modified program. In other words, they don't block
21274 the free software community from making full use of the manual.
21275
21276 However, it must be possible to modify all the technical content of
21277 the manual, and then distribute the result in all the usual media,
21278 through all the usual channels; otherwise, the restrictions do block
21279 the community, the manual is not free, and so we need another manual.
21280
21281 Unfortunately, it is often hard to find someone to write another
21282 manual when a proprietary manual exists. The obstacle is that many
21283 users think that a proprietary manual is good enough---so they don't
21284 see the need to write a free manual. They do not see that the free
21285 operating system has a gap that needs filling.
21286
21287 Why do users think that proprietary manuals are good enough? Some have
21288 not considered the issue. I hope this article will do something to
21289 change that.
21290
21291 Other users consider proprietary manuals acceptable for the same
21292 reason so many people consider proprietary software acceptable: they
21293 judge in purely practical terms, not using freedom as a
21294 criterion. These people are entitled to their opinions, but since
21295 those opinions spring from values which do not include freedom, they
21296 are no guide for those of us who do value freedom.
21297
21298 Please spread the word about this issue. We continue to lose manuals
21299 to proprietary publishing. If we spread the word that proprietary
21300 manuals are not sufficient, perhaps the next person who wants to help
21301 GNU by writing documentation will realize, before it is too late, that
21302 he must above all make it free.
21303
21304 We can also encourage commercial publishers to sell free, copylefted
21305 manuals instead of proprietary ones. One way you can help this is to
21306 check the distribution terms of a manual before you buy it, and prefer
21307 copylefted manuals to non-copylefted ones.
21308
21309 @sp 2
21310 @noindent
21311 Note: The Free Software Foundation maintains a page on its Web site
21312 that lists free books available from other publishers:@*
21313 @uref{http://www.gnu.org/doc/other-free-books.html}
21314
21315
21316 @node GNU Free Documentation License, Index, Free Software and Free Manuals, Top
21038 @appendix GNU Free Documentation License 21317 @appendix GNU Free Documentation License
21039 21318
21040 @cindex FDL, GNU Free Documentation License 21319 @cindex FDL, GNU Free Documentation License
21041 @center Version 1.1, March 2000 21320 @center Version 1.2, November 2002
21042 21321
21043 @display 21322 @display
21044 Copyright @copyright{} 2000 Free Software Foundation, Inc. 21323 Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
21045 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 21324 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
21046 21325
21047 Everyone is permitted to copy and distribute verbatim copies 21326 Everyone is permitted to copy and distribute verbatim copies
21048 of this license document, but changing it is not allowed. 21327 of this license document, but changing it is not allowed.
21049 @end display 21328 @end display
21051 @enumerate 0 21330 @enumerate 0
21052 @item 21331 @item
21053 PREAMBLE 21332 PREAMBLE
21054 21333
21055 The purpose of this License is to make a manual, textbook, or other 21334 The purpose of this License is to make a manual, textbook, or other
21056 written document @dfn{free} in the sense of freedom: to assure everyone 21335 functional and useful document @dfn{free} in the sense of freedom: to
21057 the effective freedom to copy and redistribute it, with or without 21336 assure everyone the effective freedom to copy and redistribute it,
21058 modifying it, either commercially or noncommercially. Secondarily, 21337 with or without modifying it, either commercially or noncommercially.
21059 this License preserves for the author and publisher a way to get 21338 Secondarily, this License preserves for the author and publisher a way
21060 credit for their work, while not being considered responsible for 21339 to get credit for their work, while not being considered responsible
21061 modifications made by others. 21340 for modifications made by others.
21062 21341
21063 This License is a kind of ``copyleft'', which means that derivative 21342 This License is a kind of ``copyleft'', which means that derivative
21064 works of the document must themselves be free in the same sense. It 21343 works of the document must themselves be free in the same sense. It
21065 complements the GNU General Public License, which is a copyleft 21344 complements the GNU General Public License, which is a copyleft
21066 license designed for free software. 21345 license designed for free software.
21074 principally for works whose purpose is instruction or reference. 21353 principally for works whose purpose is instruction or reference.
21075 21354
21076 @item 21355 @item
21077 APPLICABILITY AND DEFINITIONS 21356 APPLICABILITY AND DEFINITIONS
21078 21357
21079 This License applies to any manual or other work that contains a 21358 This License applies to any manual or other work, in any medium, that
21080 notice placed by the copyright holder saying it can be distributed 21359 contains a notice placed by the copyright holder saying it can be
21081 under the terms of this License. The ``Document'', below, refers to any 21360 distributed under the terms of this License. Such a notice grants a
21082 such manual or work. Any member of the public is a licensee, and is 21361 world-wide, royalty-free license, unlimited in duration, to use that
21083 addressed as ``you''. 21362 work under the conditions stated herein. The ``Document'', below,
21363 refers to any such manual or work. Any member of the public is a
21364 licensee, and is addressed as ``you''. You accept the license if you
21365 copy, modify or distribute the work in a way requiring permission
21366 under copyright law.
21084 21367
21085 A ``Modified Version'' of the Document means any work containing the 21368 A ``Modified Version'' of the Document means any work containing the
21086 Document or a portion of it, either copied verbatim, or with 21369 Document or a portion of it, either copied verbatim, or with
21087 modifications and/or translated into another language. 21370 modifications and/or translated into another language.
21088 21371
21089 A ``Secondary Section'' is a named appendix or a front-matter section of 21372 A ``Secondary Section'' is a named appendix or a front-matter section
21090 the Document that deals exclusively with the relationship of the 21373 of the Document that deals exclusively with the relationship of the
21091 publishers or authors of the Document to the Document's overall subject 21374 publishers or authors of the Document to the Document's overall
21092 (or to related matters) and contains nothing that could fall directly 21375 subject (or to related matters) and contains nothing that could fall
21093 within that overall subject. (For example, if the Document is in part a 21376 directly within that overall subject. (Thus, if the Document is in
21094 textbook of mathematics, a Secondary Section may not explain any 21377 part a textbook of mathematics, a Secondary Section may not explain
21095 mathematics.) The relationship could be a matter of historical 21378 any mathematics.) The relationship could be a matter of historical
21096 connection with the subject or with related matters, or of legal, 21379 connection with the subject or with related matters, or of legal,
21097 commercial, philosophical, ethical or political position regarding 21380 commercial, philosophical, ethical or political position regarding
21098 them. 21381 them.
21099 21382
21100 The ``Invariant Sections'' are certain Secondary Sections whose titles 21383 The ``Invariant Sections'' are certain Secondary Sections whose titles
21101 are designated, as being those of Invariant Sections, in the notice 21384 are designated, as being those of Invariant Sections, in the notice
21102 that says that the Document is released under this License. 21385 that says that the Document is released under this License. If a
21386 section does not fit the above definition of Secondary then it is not
21387 allowed to be designated as Invariant. The Document may contain zero
21388 Invariant Sections. If the Document does not identify any Invariant
21389 Sections then there are none.
21103 21390
21104 The ``Cover Texts'' are certain short passages of text that are listed, 21391 The ``Cover Texts'' are certain short passages of text that are listed,
21105 as Front-Cover Texts or Back-Cover Texts, in the notice that says that 21392 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
21106 the Document is released under this License. 21393 the Document is released under this License. A Front-Cover Text may
21394 be at most 5 words, and a Back-Cover Text may be at most 25 words.
21107 21395
21108 A ``Transparent'' copy of the Document means a machine-readable copy, 21396 A ``Transparent'' copy of the Document means a machine-readable copy,
21109 represented in a format whose specification is available to the 21397 represented in a format whose specification is available to the
21110 general public, whose contents can be viewed and edited directly and 21398 general public, that is suitable for revising the document
21111 straightforwardly with generic text editors or (for images composed of 21399 straightforwardly with generic text editors or (for images composed of
21112 pixels) generic paint programs or (for drawings) some widely available 21400 pixels) generic paint programs or (for drawings) some widely available
21113 drawing editor, and that is suitable for input to text formatters or 21401 drawing editor, and that is suitable for input to text formatters or
21114 for automatic translation to a variety of formats suitable for input 21402 for automatic translation to a variety of formats suitable for input
21115 to text formatters. A copy made in an otherwise Transparent file 21403 to text formatters. A copy made in an otherwise Transparent file
21116 format whose markup has been designed to thwart or discourage 21404 format whose markup, or absence of markup, has been arranged to thwart
21117 subsequent modification by readers is not Transparent. A copy that is 21405 or discourage subsequent modification by readers is not Transparent.
21118 not ``Transparent'' is called ``Opaque''. 21406 An image format is not Transparent if used for any substantial amount
21407 of text. A copy that is not ``Transparent'' is called ``Opaque''.
21119 21408
21120 Examples of suitable formats for Transparent copies include plain 21409 Examples of suitable formats for Transparent copies include plain
21121 @sc{ascii} without markup, Texinfo input format, La@TeX{} input format, 21410 @sc{ascii} without markup, Texinfo input format, La@TeX{} input
21122 @acronym{SGML} or @acronym{XML} using a publicly available 21411 format, @acronym{SGML} or @acronym{XML} using a publicly available
21123 @acronym{DTD}, and standard-conforming simple @acronym{HTML} designed 21412 @acronym{DTD}, and standard-conforming simple @acronym{HTML},
21124 for human modification. Opaque formats include PostScript, 21413 PostScript or @acronym{PDF} designed for human modification. Examples
21125 @acronym{PDF}, proprietary formats that can be read and edited only by 21414 of transparent image formats include @acronym{PNG}, @acronym{XCF} and
21126 proprietary word processors, @acronym{SGML} or @acronym{XML} for which 21415 @acronym{JPG}. Opaque formats include proprietary formats that can be
21127 the @acronym{DTD} and/or processing tools are not generally available, 21416 read and edited only by proprietary word processors, @acronym{SGML} or
21128 and the machine-generated @acronym{HTML} produced by some word 21417 @acronym{XML} for which the @acronym{DTD} and/or processing tools are
21129 processors for output purposes only. 21418 not generally available, and the machine-generated @acronym{HTML},
21419 PostScript or @acronym{PDF} produced by some word processors for
21420 output purposes only.
21130 21421
21131 The ``Title Page'' means, for a printed book, the title page itself, 21422 The ``Title Page'' means, for a printed book, the title page itself,
21132 plus such following pages as are needed to hold, legibly, the material 21423 plus such following pages as are needed to hold, legibly, the material
21133 this License requires to appear in the title page. For works in 21424 this License requires to appear in the title page. For works in
21134 formats which do not have any title page as such, ``Title Page'' means 21425 formats which do not have any title page as such, ``Title Page'' means
21135 the text near the most prominent appearance of the work's title, 21426 the text near the most prominent appearance of the work's title,
21136 preceding the beginning of the body of the text. 21427 preceding the beginning of the body of the text.
21428
21429 A section ``Entitled XYZ'' means a named subunit of the Document whose
21430 title either is precisely XYZ or contains XYZ in parentheses following
21431 text that translates XYZ in another language. (Here XYZ stands for a
21432 specific section name mentioned below, such as ``Acknowledgements'',
21433 ``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
21434 of such a section when you modify the Document means that it remains a
21435 section ``Entitled XYZ'' according to this definition.
21436
21437 The Document may include Warranty Disclaimers next to the notice which
21438 states that this License applies to the Document. These Warranty
21439 Disclaimers are considered to be included by reference in this
21440 License, but only as regards disclaiming warranties: any other
21441 implication that these Warranty Disclaimers may have is void and has
21442 no effect on the meaning of this License.
21137 21443
21138 @item 21444 @item
21139 VERBATIM COPYING 21445 VERBATIM COPYING
21140 21446
21141 You may copy and distribute the Document in any medium, either 21447 You may copy and distribute the Document in any medium, either
21152 you may publicly display copies. 21458 you may publicly display copies.
21153 21459
21154 @item 21460 @item
21155 COPYING IN QUANTITY 21461 COPYING IN QUANTITY
21156 21462
21157 If you publish printed copies of the Document numbering more than 100, 21463 If you publish printed copies (or copies in media that commonly have
21158 and the Document's license notice requires Cover Texts, you must enclose 21464 printed covers) of the Document, numbering more than 100, and the
21159 the copies in covers that carry, clearly and legibly, all these Cover 21465 Document's license notice requires Cover Texts, you must enclose the
21466 copies in covers that carry, clearly and legibly, all these Cover
21160 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on 21467 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
21161 the back cover. Both covers must also clearly and legibly identify 21468 the back cover. Both covers must also clearly and legibly identify
21162 you as the publisher of these copies. The front cover must present 21469 you as the publisher of these copies. The front cover must present
21163 the full title with all words of the title equally prominent and 21470 the full title with all words of the title equally prominent and
21164 visible. You may add other material on the covers in addition. 21471 visible. You may add other material on the covers in addition.
21172 pages. 21479 pages.
21173 21480
21174 If you publish or distribute Opaque copies of the Document numbering 21481 If you publish or distribute Opaque copies of the Document numbering
21175 more than 100, you must either include a machine-readable Transparent 21482 more than 100, you must either include a machine-readable Transparent
21176 copy along with each Opaque copy, or state in or with each Opaque copy 21483 copy along with each Opaque copy, or state in or with each Opaque copy
21177 a publicly-accessible computer-network location containing a complete 21484 a computer-network location from which the general network-using
21178 Transparent copy of the Document, free of added material, which the 21485 public has access to download using public-standard network protocols
21179 general network-using public has access to download anonymously at no 21486 a complete Transparent copy of the Document, free of added material.
21180 charge using public-standard network protocols. If you use the latter 21487 If you use the latter option, you must take reasonably prudent steps,
21181 option, you must take reasonably prudent steps, when you begin 21488 when you begin distribution of Opaque copies in quantity, to ensure
21182 distribution of Opaque copies in quantity, to ensure that this 21489 that this Transparent copy will remain thus accessible at the stated
21183 Transparent copy will remain thus accessible at the stated location 21490 location until at least one year after the last time you distribute an
21184 until at least one year after the last time you distribute an Opaque 21491 Opaque copy (directly or through your agents or retailers) of that
21185 copy (directly or through your agents or retailers) of that edition to 21492 edition to the public.
21186 the public.
21187 21493
21188 It is requested, but not required, that you contact the authors of the 21494 It is requested, but not required, that you contact the authors of the
21189 Document well before redistributing any large number of copies, to give 21495 Document well before redistributing any large number of copies, to give
21190 them a chance to provide you with an updated version of the Document. 21496 them a chance to provide you with an updated version of the Document.
21191 21497
21209 21515
21210 @item 21516 @item
21211 List on the Title Page, as authors, one or more persons or entities 21517 List on the Title Page, as authors, one or more persons or entities
21212 responsible for authorship of the modifications in the Modified 21518 responsible for authorship of the modifications in the Modified
21213 Version, together with at least five of the principal authors of the 21519 Version, together with at least five of the principal authors of the
21214 Document (all of its principal authors, if it has less than five). 21520 Document (all of its principal authors, if it has fewer than five),
21521 unless they release you from this requirement.
21215 21522
21216 @item 21523 @item
21217 State on the Title page the name of the publisher of the 21524 State on the Title page the name of the publisher of the
21218 Modified Version, as the publisher. 21525 Modified Version, as the publisher.
21219 21526
21235 21542
21236 @item 21543 @item
21237 Include an unaltered copy of this License. 21544 Include an unaltered copy of this License.
21238 21545
21239 @item 21546 @item
21240 Preserve the section entitled ``History'', and its title, and add to 21547 Preserve the section Entitled ``History'', Preserve its Title, and add
21241 it an item stating at least the title, year, new authors, and 21548 to it an item stating at least the title, year, new authors, and
21242 publisher of the Modified Version as given on the Title Page. If 21549 publisher of the Modified Version as given on the Title Page. If
21243 there is no section entitled ``History'' in the Document, create one 21550 there is no section Entitled ``History'' in the Document, create one
21244 stating the title, year, authors, and publisher of the Document as 21551 stating the title, year, authors, and publisher of the Document as
21245 given on its Title Page, then add an item describing the Modified 21552 given on its Title Page, then add an item describing the Modified
21246 Version as stated in the previous sentence. 21553 Version as stated in the previous sentence.
21247 21554
21248 @item 21555 @item
21253 You may omit a network location for a work that was published at 21560 You may omit a network location for a work that was published at
21254 least four years before the Document itself, or if the original 21561 least four years before the Document itself, or if the original
21255 publisher of the version it refers to gives permission. 21562 publisher of the version it refers to gives permission.
21256 21563
21257 @item 21564 @item
21258 In any section entitled ``Acknowledgments'' or ``Dedications'', 21565 For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
21259 preserve the section's title, and preserve in the section all the 21566 the Title of the section, and preserve in the section all the
21260 substance and tone of each of the contributor acknowledgments 21567 substance and tone of each of the contributor acknowledgements and/or
21261 and/or dedications given therein. 21568 dedications given therein.
21262 21569
21263 @item 21570 @item
21264 Preserve all the Invariant Sections of the Document, 21571 Preserve all the Invariant Sections of the Document,
21265 unaltered in their text and in their titles. Section numbers 21572 unaltered in their text and in their titles. Section numbers
21266 or the equivalent are not considered part of the section titles. 21573 or the equivalent are not considered part of the section titles.
21267 21574
21268 @item 21575 @item
21269 Delete any section entitled ``Endorsements''. Such a section 21576 Delete any section Entitled ``Endorsements''. Such a section
21270 may not be included in the Modified Version. 21577 may not be included in the Modified Version.
21271 21578
21272 @item 21579 @item
21273 Do not retitle any existing section as ``Endorsements'' 21580 Do not retitle any existing section to be Entitled ``Endorsements'' or
21274 or to conflict in title with any Invariant Section. 21581 to conflict in title with any Invariant Section.
21582
21583 @item
21584 Preserve any Warranty Disclaimers.
21275 @end enumerate 21585 @end enumerate
21276 21586
21277 If the Modified Version includes new front-matter sections or 21587 If the Modified Version includes new front-matter sections or
21278 appendices that qualify as Secondary Sections and contain no material 21588 appendices that qualify as Secondary Sections and contain no material
21279 copied from the Document, you may at your option designate some or all 21589 copied from the Document, you may at your option designate some or all
21280 of these sections as invariant. To do this, add their titles to the 21590 of these sections as invariant. To do this, add their titles to the
21281 list of Invariant Sections in the Modified Version's license notice. 21591 list of Invariant Sections in the Modified Version's license notice.
21282 These titles must be distinct from any other section titles. 21592 These titles must be distinct from any other section titles.
21283 21593
21284 You may add a section entitled ``Endorsements'', provided it contains 21594 You may add a section Entitled ``Endorsements'', provided it contains
21285 nothing but endorsements of your Modified Version by various 21595 nothing but endorsements of your Modified Version by various
21286 parties---for example, statements of peer review or that the text has 21596 parties---for example, statements of peer review or that the text has
21287 been approved by an organization as the authoritative definition of a 21597 been approved by an organization as the authoritative definition of a
21288 standard. 21598 standard.
21289 21599
21307 You may combine the Document with other documents released under this 21617 You may combine the Document with other documents released under this
21308 License, under the terms defined in section 4 above for modified 21618 License, under the terms defined in section 4 above for modified
21309 versions, provided that you include in the combination all of the 21619 versions, provided that you include in the combination all of the
21310 Invariant Sections of all of the original documents, unmodified, and 21620 Invariant Sections of all of the original documents, unmodified, and
21311 list them all as Invariant Sections of your combined work in its 21621 list them all as Invariant Sections of your combined work in its
21312 license notice. 21622 license notice, and that you preserve all their Warranty Disclaimers.
21313 21623
21314 The combined work need only contain one copy of this License, and 21624 The combined work need only contain one copy of this License, and
21315 multiple identical Invariant Sections may be replaced with a single 21625 multiple identical Invariant Sections may be replaced with a single
21316 copy. If there are multiple Invariant Sections with the same name but 21626 copy. If there are multiple Invariant Sections with the same name but
21317 different contents, make the title of each such section unique by 21627 different contents, make the title of each such section unique by
21318 adding at the end of it, in parentheses, the name of the original 21628 adding at the end of it, in parentheses, the name of the original
21319 author or publisher of that section if known, or else a unique number. 21629 author or publisher of that section if known, or else a unique number.
21320 Make the same adjustment to the section titles in the list of 21630 Make the same adjustment to the section titles in the list of
21321 Invariant Sections in the license notice of the combined work. 21631 Invariant Sections in the license notice of the combined work.
21322 21632
21323 In the combination, you must combine any sections entitled ``History'' 21633 In the combination, you must combine any sections Entitled ``History''
21324 in the various original documents, forming one section entitled 21634 in the various original documents, forming one section Entitled
21325 ``History''; likewise combine any sections entitled ``Acknowledgments'', 21635 ``History''; likewise combine any sections Entitled ``Acknowledgements'',
21326 and any sections entitled ``Dedications''. You must delete all sections 21636 and any sections Entitled ``Dedications''. You must delete all
21327 entitled ``Endorsements.'' 21637 sections Entitled ``Endorsements.''
21328 21638
21329 @item 21639 @item
21330 COLLECTIONS OF DOCUMENTS 21640 COLLECTIONS OF DOCUMENTS
21331 21641
21332 You may make a collection consisting of the Document and other documents 21642 You may make a collection consisting of the Document and other documents
21343 @item 21653 @item
21344 AGGREGATION WITH INDEPENDENT WORKS 21654 AGGREGATION WITH INDEPENDENT WORKS
21345 21655
21346 A compilation of the Document or its derivatives with other separate 21656 A compilation of the Document or its derivatives with other separate
21347 and independent documents or works, in or on a volume of a storage or 21657 and independent documents or works, in or on a volume of a storage or
21348 distribution medium, does not as a whole count as a Modified Version 21658 distribution medium, is called an ``aggregate'' if the copyright
21349 of the Document, provided no compilation copyright is claimed for the 21659 resulting from the compilation is not used to limit the legal rights
21350 compilation. Such a compilation is called an ``aggregate'', and this 21660 of the compilation's users beyond what the individual works permit.
21351 License does not apply to the other self-contained works thus compiled 21661 When the Document is included in an aggregate, this License does not
21352 with the Document, on account of their being thus compiled, if they 21662 apply to the other works in the aggregate which are not themselves
21353 are not themselves derivative works of the Document. 21663 derivative works of the Document.
21354 21664
21355 If the Cover Text requirement of section 3 is applicable to these 21665 If the Cover Text requirement of section 3 is applicable to these
21356 copies of the Document, then if the Document is less than one quarter 21666 copies of the Document, then if the Document is less than one half of
21357 of the entire aggregate, the Document's Cover Texts may be placed on 21667 the entire aggregate, the Document's Cover Texts may be placed on
21358 covers that surround only the Document within the aggregate. 21668 covers that bracket the Document within the aggregate, or the
21359 Otherwise they must appear on covers around the whole aggregate. 21669 electronic equivalent of covers if the Document is in electronic form.
21670 Otherwise they must appear on printed covers that bracket the whole
21671 aggregate.
21360 21672
21361 @item 21673 @item
21362 TRANSLATION 21674 TRANSLATION
21363 21675
21364 Translation is considered a kind of modification, so you may 21676 Translation is considered a kind of modification, so you may
21365 distribute translations of the Document under the terms of section 4. 21677 distribute translations of the Document under the terms of section 4.
21366 Replacing Invariant Sections with translations requires special 21678 Replacing Invariant Sections with translations requires special
21367 permission from their copyright holders, but you may include 21679 permission from their copyright holders, but you may include
21368 translations of some or all Invariant Sections in addition to the 21680 translations of some or all Invariant Sections in addition to the
21369 original versions of these Invariant Sections. You may include a 21681 original versions of these Invariant Sections. You may include a
21370 translation of this License provided that you also include the 21682 translation of this License, and all the license notices in the
21371 original English version of this License. In case of a disagreement 21683 Document, and any Warranty Disclaimers, provided that you also include
21372 between the translation and the original English version of this 21684 the original English version of this License and the original versions
21373 License, the original English version will prevail. 21685 of those notices and disclaimers. In case of a disagreement between
21686 the translation and the original version of this License or a notice
21687 or disclaimer, the original version will prevail.
21688
21689 If a section in the Document is Entitled ``Acknowledgements'',
21690 ``Dedications'', or ``History'', the requirement (section 4) to Preserve
21691 its Title (section 1) will typically require changing the actual
21692 title.
21374 21693
21375 @item 21694 @item
21376 TERMINATION 21695 TERMINATION
21377 21696
21378 You may not copy, modify, sublicense, or distribute the Document except 21697 You may not copy, modify, sublicense, or distribute the Document except
21399 of any later version that has been published (not as a draft) by the 21718 of any later version that has been published (not as a draft) by the
21400 Free Software Foundation. If the Document does not specify a version 21719 Free Software Foundation. If the Document does not specify a version
21401 number of this License, you may choose any version ever published (not 21720 number of this License, you may choose any version ever published (not
21402 as a draft) by the Free Software Foundation. 21721 as a draft) by the Free Software Foundation.
21403 @end enumerate 21722 @end enumerate
21723
21724 @page
21725 @appendixsubsec ADDENDUM: How to use this License for your documents
21726
21727 To use this License in a document you have written, include a copy of
21728 the License in the document and put the following copyright and
21729 license notices just after the title page:
21730
21731 @smallexample
21732 @group
21733 Copyright (C) @var{year} @var{your name}.
21734 Permission is granted to copy, distribute and/or modify this document
21735 under the terms of the GNU Free Documentation License, Version 1.2
21736 or any later version published by the Free Software Foundation;
21737 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
21738 A copy of the license is included in the section entitled ``GNU
21739 Free Documentation License''.
21740 @end group
21741 @end smallexample
21742
21743 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
21744 replace the ``with...Texts.'' line with this:
21745
21746 @smallexample
21747 @group
21748 with the Invariant Sections being @var{list their titles}, with
21749 the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
21750 being @var{list}.
21751 @end group
21752 @end smallexample
21753
21754 If you have Invariant Sections without Cover Texts, or some other
21755 combination of the three, merge those two alternatives to suit the
21756 situation.
21757
21758 If your document contains nontrivial examples of program code, we
21759 recommend releasing these examples in parallel under your choice of
21760 free software license, such as the GNU General Public License,
21761 to permit their use in free software.
21404 21762
21405 @node Index, About the Author, GNU Free Documentation License, Top 21763 @node Index, About the Author, GNU Free Documentation License, Top
21406 @comment node-name, next, previous, up 21764 @comment node-name, next, previous, up
21407 @unnumbered Index 21765 @unnumbered Index
21408 21766