Add .info extension to @setfilename commands in doc/
[bpt/emacs.git] / doc / lispintro / emacs-lisp-intro.texi
index ce4da17..6001e3d 100644 (file)
@@ -1,28 +1,54 @@
 \input texinfo                                      @c -*-texinfo-*-
 @comment %**start of header
-@setfilename ../../info/eintr
+@setfilename ../../info/eintr.info
 @c setfilename emacs-lisp-intro.info
 @c sethtmlfilename emacs-lisp-intro.html
 @settitle Programming in Emacs Lisp
+@documentencoding UTF-8
 @syncodeindex vr cp
 @syncodeindex fn cp
 @finalout
 
 @include emacsver.texi
 
-@c ---------
+@c ================ How to Print a Book in Various Sizes ================
+
+@c This book can be printed in any of three different sizes.
+@c Set the following @-commands appropriately.
+
+@c     7 by 9.25 inches:
+@c              @smallbook
+@c              @clear largebook
+
+@c     8.5 by 11 inches:
+@c              @c smallbook
+@c              @set largebook
+
+@c     European A4 size paper:
+@c              @c smallbook
+@c              @afourpaper
+@c              @set largebook
+
+@c (Note: if you edit the book so as to change the length of the
+@c table of contents, you may have to change the value of `pageno' below.)
+
 @c <<<< For hard copy printing, this file is now
 @c      set for smallbook, which works for all sizes
 @c      of paper, and with PostScript figures >>>>
+
 @set smallbook
 @ifset smallbook
 @smallbook
 @clear  largebook
 @end ifset
+
+@c ================ Included Figures ================
+
+@c If you clear this, the figures will be printed as ASCII diagrams
+@c rather than PostScript/PDF.
+@c (This is not relevant to Info, since Info only handles ASCII.)
 @set print-postscript-figures
-@c set largebook
 @c clear print-postscript-figures
-@c ---------
 
 @comment %**end of header
 
 @set edition-number 3.10
 @set update-date 28 October 2009
 
-@c ================ Included Figures ================
-
-@c Set  print-postscript-figures  if you print PostScript figures.
-@c If you clear this, the ten figures will be printed as ASCII diagrams.
-@c (This is not relevant to Info, since Info only handles ASCII.)
-@c Your site may require editing changes to print PostScript; in this
-@c case, search for `print-postscript-figures' and make appropriate changes.
-
-@c ================ How to Print a Book in Various Sizes ================
-
-@c This book can be printed in any of three different sizes.
-@c In the above header, set @-commands appropriately.
-
-@c     7 by 9.25 inches:
-@c              @smallbook
-@c              @clear largebook
-
-@c     8.5 by 11 inches:
-@c              @c smallbook
-@c              @set largebook
-
-@c     European A4 size paper:
-@c              @c smallbook
-@c              @afourpaper
-@c              @set largebook
-
-@c (Note: if you edit the book so as to change the length of the
-@c table of contents, you may have to change the value of `pageno' below.)
-
-@c ================ End of Formatting Sections ================
-
 @c For next or subsequent edition:
 @c   create function using with-output-to-temp-buffer
 @c   create a major mode, with keymaps
 
 @c ----------------------------------------------------
 
-@dircategory GNU Emacs Lisp
+@dircategory Emacs lisp
 @direntry
-* Emacs Lisp Intro: (eintr).
-                          A simple introduction to Emacs Lisp programming.
+* Emacs Lisp Intro: (eintr).    A simple introduction to Emacs Lisp programming.
 @end direntry
 
 @copying
@@ -118,16 +112,8 @@ Edition @value{edition-number}, @value{update-date}
 @ifnottex
 Distributed with Emacs version @value{EMACSVER}.
 @end ifnottex
-@ifset WWW_GNU_ORG
-@html
-<p>The homepage for GNU Emacs is at
-<a href="http://www.gnu.org/software/emacs/">http://www.gnu.org/software/emacs/</a>.
-<br>To view this manual in other formats, click
-<a href="/software/emacs/emacs-lisp-intro/emacs-lisp-intro.html">here</a>.
-@end html
-@end ifset
 @sp 1
-Copyright @copyright{} 1990--1995, 1997, 2001--2013 Free Software
+Copyright @copyright{} 1990--1995, 1997, 2001--2014 Free Software
 Foundation, Inc.
 @sp 1
 
@@ -156,6 +142,7 @@ Boston, MA 02110-1301 USA
 @sp 1
 ISBN 1-882114-43-4
 
+@quotation
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
 any later version published by the Free Software Foundation; there
@@ -167,6 +154,7 @@ Documentation License''.
 (a) The FSF's Back-Cover Text is: ``You have the freedom to
 copy and modify this GNU manual.  Buying copies from the FSF
 supports it in developing GNU and promoting software freedom.''
+@end quotation
 @end copying
 
 @c half title; two lines here, so do not use `shorttitlepage'
@@ -217,6 +205,15 @@ supports it in developing GNU and promoting software freedom.''
 @node Top
 @top An Introduction to Programming in Emacs Lisp
 
+@ifset WWW_GNU_ORG
+@html
+<p>The homepage for GNU Emacs is at
+<a href="/software/emacs/">http://www.gnu.org/software/emacs/</a>.<br>
+To view this manual in other formats, click
+<a href="/software/emacs/manual/eintr.html">here</a>.
+@end html
+@end ifset
+
 @insertcopying
 
 This master menu first lists each chapter and index; then it lists
@@ -653,7 +650,7 @@ Your @file{.emacs} File
 * Default Configuration::
 * Site-wide Init::              You can write site-wide init files.
 * defcustom::                   Emacs will write code for you.
-* Beginning a .emacs File::     How to write a @code{.emacs file}.
+* Beginning init File::         How to write a @file{.emacs} init file.
 * Text and Auto-fill::          Automatically wrap lines.
 * Mail Aliases::                Use abbreviations for email addresses.
 * Indent Tabs Mode::            Don't use tabs with @TeX{}
@@ -959,7 +956,12 @@ encouragement.  My mistakes are my own.
 
 @flushright
 Robert J. Chassell
+@ifnothtml
 @email{bob@@gnu.org}
+@end ifnothtml
+@ifhtml
+bob@@gnu.org
+@end ifhtml
 @end flushright
 
 @c ================ Beginning of main text ================
@@ -3265,7 +3267,7 @@ line that follows a semicolon is a comment.  The end of the line is the
 end of the comment.  To stretch a comment over two or more lines, begin
 each line with a semicolon.
 
-@xref{Beginning a .emacs File, , Beginning a @file{.emacs}
+@xref{Beginning init File, , Beginning a @file{.emacs}
 File}, and @ref{Comments, , Comments, elisp, The GNU Emacs Lisp
 Reference Manual}, for more about comments.
 
@@ -6323,7 +6325,7 @@ and avoids clobbering the mark."
                         (/ (+ 10 (* size (prefix-numeric-value arg)))
                            10)))
                  (point-min))))
-  (if arg (forward-line 1)))
+  (if (and arg (not (consp arg))) (forward-line 1)))
 @end group
 @end smallexample
 
@@ -6390,7 +6392,7 @@ to move point to the beginning of the next line if the command is
 invoked with an argument:
 
 @smallexample
-(if arg (forward-line 1)))
+(if (and arg (not (consp arg))) (forward-line 1))
 @end smallexample
 
 @noindent
@@ -6399,14 +6401,10 @@ appropriate tenths position in the buffer.  This is a flourish that
 means that the cursor is always located @emph{at least} the requested
 tenths of the way through the buffer, which is a nicety that is,
 perhaps, not necessary, but which, if it did not occur, would be sure
-to draw complaints.
-
-On the other hand, it also means that if you specify the command with
-a @kbd{C-u}, but without a number, that is to say, if the `raw prefix
-argument' is simply a cons cell, then the command puts you at the
-beginning of the second line @dots{}  I don't know whether this is
-intended or whether no one has dealt with the code to avoid this
-happening.
+to draw complaints.  (The @code{(not (consp arg))} portion is so that
+if you specify the command with a @kbd{C-u}, but without a number,
+that is to say, if the `raw prefix argument' is simply a cons cell,
+the command does not put you at the beginning of the second line.)
 
 @node Second Buffer Related Review
 @section Review
@@ -7542,20 +7540,7 @@ retrieved.  @xref{Yanking, , Yanking Text Back}.
 @section @code{zap-to-char}
 @findex zap-to-char
 
-@c FIXME remove obsolete stuff
-The @code{zap-to-char} function changed little between GNU Emacs
-version 19 and GNU Emacs version 22.  However, @code{zap-to-char}
-calls another function, @code{kill-region}, which enjoyed a major
-rewrite.
-
-The @code{kill-region} function in Emacs 19 is complex, but does not
-use code that is important at this time.  We will skip it.
-
-The @code{kill-region} function in Emacs 22 is easier to read than the
-same function in Emacs 19 and introduces a very important concept,
-that of error handling.  We will walk through the function.
-
-But first, let us look at the interactive @code{zap-to-char} function.
+Let us look at the interactive @code{zap-to-char} function.
 
 @menu
 * Complete zap-to-char::        The complete implementation.
@@ -8330,7 +8315,7 @@ As usual, this function can be divided into its component parts:
 
 The arguments are @code{beg} and @code{end} and the function is
 interactive with @code{"r"}, so the two arguments must refer to the
-beginning and end of the region.  If you have been reading though this
+beginning and end of the region.  If you have been reading through this
 document from the beginning, understanding these parts of a function is
 almost becoming routine.
 
@@ -9523,10 +9508,6 @@ This sounds more complicated than it is and is easier seen in a diagram:
 @sp 1
 @tex
 @center @image{cons-1}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/cons-1.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -9586,10 +9567,6 @@ bouquet
 @sp 1
 @tex
 @center @image{cons-2}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/cons-2.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -9635,10 +9612,6 @@ bouquet
 @sp 1
 @tex
 @center @image{cons-2a}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/cons-2a.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -9702,10 +9675,6 @@ bouquet        flowers
 @sp 1
 @tex
 @center @image{cons-3}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/cons-3.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -9774,10 +9743,6 @@ bouquet                       flowers
 @sp 1
 @tex
 @center @image{cons-4}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/cons-4.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -9891,10 +9856,6 @@ Here is a fanciful representation:
 @sp 1
 @tex
 @center @image{drawers}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/drawers.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -10067,10 +10028,6 @@ kill-ring     kill-ring-yank-pointer
 @sp 1
 @tex
 @center @image{cons-5}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/cons-5.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -11653,7 +11610,7 @@ and this provides a sense of its primal capabilities.
 @node Every
 @unnumberedsubsubsec Recursive Pattern: @emph{every}
 @cindex Every, type of recursive pattern
-@cindex Recursive pattern: every
+@cindex Recursive pattern - every
 
 In the @code{every} recursive pattern, an action is performed on every
 element of a list.
@@ -11752,7 +11709,7 @@ But when the list has at least one element,
 @node Accumulate
 @unnumberedsubsubsec Recursive Pattern: @emph{accumulate}
 @cindex Accumulate, type of recursive pattern
-@cindex Recursive pattern: accumulate
+@cindex Recursive pattern - accumulate
 
 Another recursive pattern is called the @code{accumulate} pattern.  In
 the @code{accumulate} recursive pattern, an action is performed on
@@ -11803,7 +11760,7 @@ accumulate pattern.
 @node Keep
 @unnumberedsubsubsec Recursive Pattern: @emph{keep}
 @cindex Keep, type of recursive pattern
-@cindex Recursive pattern: keep
+@cindex Recursive pattern - keep
 
 A third recursive pattern is called the @code{keep} pattern.
 In the @code{keep} recursive pattern, each element of a list is tested;
@@ -11955,7 +11912,6 @@ more steps.
 @node No deferment solution
 @subsection No Deferment Solution
 @cindex No deferment solution
-@cindex Defermentless solution
 @cindex Solution without deferment
 
 The solution to the problem of deferred operations is to write in a
@@ -13589,7 +13545,7 @@ regexps.  @xref{the-the, , @code{the-the} Duplicated Words Function}.
 @end itemize
 
 @node Counting Words
-@chapter Counting: Repetition and Regexps
+@chapter Counting via Repetition and Regexps
 @cindex Repetition for word counting
 @cindex Regular expressions for word counting
 
@@ -14473,7 +14429,7 @@ exclamation mark, and question mark.  Do the same using recursion.
 
 Our next project is to count the number of words in a function
 definition.  Clearly, this can be done using some variant of
-@code{@value{COUNT-WORDS}}.  @xref{Counting Words, , Counting Words:
+@code{@value{COUNT-WORDS}}.  @xref{Counting Words, , Counting via
 Repetition and Regexps}.  If we are just going to count the words in
 one definition, it is easy enough to mark the definition with the
 @kbd{C-M-h} (@code{mark-defun}) command, and then call
@@ -15105,18 +15061,19 @@ C-e} (@code{eval-last-sexp}).
 @c !!! 22.1.1 lisp sources location here
 @smallexample
 (lengths-list-file
- "/usr/local/share/emacs/22.1.1/lisp/emacs-lisp/debug.el")
+ "/usr/local/share/emacs/22.1/lisp/emacs-lisp/debug.el")
 @end smallexample
 
 @noindent
-(You may need to change the pathname of the file; the one here is for
-GNU Emacs version 22.1.1.  To change the expression, copy it to
+You may need to change the pathname of the file; the one here is for
+GNU Emacs version 22.1.  To change the expression, copy it to
 the @file{*scratch*} buffer and edit it.
 
 @need 1200
 @noindent
-(Also, to see the full length of the list, rather than a truncated
+Also, to see the full length of the list, rather than a truncated
 version, you may have to evaluate the following:
+@c We do not want to insert, so do not mention the zero prefix argument.
 
 @smallexample
 (custom-set-variables '(eval-expression-print-length nil))
@@ -15142,7 +15099,8 @@ took seven seconds to produce and looked like this:
 (75 41 80 62 20 45 44 68 45 12 34 235)
 @end smallexample
 
-(The newer version of @file{debug.el} contains more defuns than the
+@noindent
+The newer version of @file{debug.el} contains more defuns than the
 earlier one; and my new machine is much faster than the old one.)
 
 Note that the length of the last definition in the file is first in
@@ -15647,7 +15605,7 @@ Let's write a function definition to do these tasks.  We will use a
 directory, checking what needs to be done; and we will use a recursive
 call to repeat the actions on each sub-directory.  The recursive
 pattern is `accumulate'
-(@pxref{Accumulate, , Recursive Pattern: @emph{accumulate}}),
+(@pxref{Accumulate}),
 using @code{append} as the combiner.
 
 @ignore
@@ -16752,7 +16710,7 @@ expressions in Emacs Lisp you can change or extend Emacs.
 * Default Configuration::
 * Site-wide Init::              You can write site-wide init files.
 * defcustom::                   Emacs will write code for you.
-* Beginning a .emacs File::     How to write a @code{.emacs file}.
+* Beginning init File::         How to write a @file{.emacs} init file.
 * Text and Auto-fill::          Automatically wrap lines.
 * Mail Aliases::                Use abbreviations for email addresses.
 * Indent Tabs Mode::            Don't use tabs with @TeX{}
@@ -17023,7 +16981,7 @@ intent is that neither programs nor users should ever change a value
 set by @code{defconst}.  (You can change it; the value set is a
 variable; but please do not.)
 
-@node Beginning a .emacs File
+@node Beginning init File
 @section Beginning a @file{.emacs} File
 @cindex @file{.emacs} file, beginning of
 
@@ -17590,8 +17548,8 @@ are not loaded right away; but you need to wait a moment when you
 first use such a function, while its containing file is evaluated.
 
 Rarely used functions are frequently autoloaded.  The
-@file{loaddefs.el} library contains hundreds of autoloaded functions,
-from @code{bookmark-set} to @code{wordstar-mode}.  Of course, you may
+@file{loaddefs.el} library contains thousands of autoloaded functions,
+from @code{5x5} to @code{zone}.  Of course, you may
 come to use a `rare' function frequently.  When you do, you should
 load that function's file with a @code{load} expression in your
 @file{.emacs} file.
@@ -17797,7 +17755,7 @@ file that set values:
 
 @group
 ;; Set calendar highlighting colors
-(setq calendar-load-hook
+(add-hook 'calendar-load-hook
       (lambda ()
         (set-face-foreground 'diary-face   "skyblue")
         (set-face-background 'holiday-face "slate blue")
@@ -18517,7 +18475,7 @@ shows which line you are currently executing.
 You can walk through the execution of a function, line by line, or run
 quickly until reaching a @dfn{breakpoint} where execution stops.
 
-Edebug is described in @ref{edebug, , Edebug, elisp, The GNU Emacs
+Edebug is described in @ref{Edebug, , , elisp, The GNU Emacs
 Lisp Reference Manual}.
 
 @need 1250
@@ -18644,7 +18602,7 @@ error or at specified stopping points; you can cause it to display the
 changing values of various expressions; you can find out how many
 times a function is called, and more.
 
-Edebug is described in @ref{edebug, , Edebug, elisp, The GNU Emacs
+Edebug is described in @ref{Edebug, , , elisp, The GNU Emacs
 Lisp Reference Manual}.
 
 @need 1500
@@ -20878,10 +20836,7 @@ equivalent of @code{multiply-by-seven} is:
 @noindent
 If we want to multiply 3 by 7, we can write:
 
-@c !!! Clear print-postscript-figures if the computer formatting this
-@c     document is too small and cannot handle all the diagrams and figures.
 @c clear print-postscript-figures
-@c set print-postscript-figures
 @c lambda example diagram #1
 @ifnottex
 @smallexample
@@ -20897,10 +20852,6 @@ If we want to multiply 3 by 7, we can write:
 @sp 1
 @tex
 @center @image{lambda-1}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/lambda-1.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -20939,10 +20890,6 @@ Similarly, we can write:
 @sp 1
 @tex
 @center @image{lambda-2}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/lambda-2.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset
@@ -20978,10 +20925,6 @@ If we want to divide 100 by 50, we can write:
 @sp 1
 @tex
 @center @image{lambda-3}
-%%%% old method of including an image
-% \input /usr/local/lib/tex/inputs/psfig.tex
-% \centerline{\psfig{figure=/usr/local/lib/emacs/man/lambda-3.eps}}
-% \catcode`\@=0 %
 @end tex
 @sp 1
 @end ifset