]> code.delx.au - gnu-emacs/blobdiff - lispref/intro.texi
Patch from rms.
[gnu-emacs] / lispref / intro.texi
index b671c89c8f1374a489d77d4e13fe06fc1e158b76..b0e563f3fd27e062203a523d5627d31431648569 100644 (file)
@@ -11,7 +11,7 @@
 
 @display
 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+59 Temple Place, Suite 330, Boston, MA 02111, USA
 
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.
@@ -343,7 +343,7 @@ the ``copyright'' line and a pointer to where the full notice is found.
 
 @smallexample
 @var{one line to give the program's name and an idea of what it does.}
-Copyright (C) 19@var{yy}  @var{name of author}
+Copyright (C) @var{year}  @var{name of author}
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
@@ -357,7 +357,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 @end smallexample
 
 Also add information on how to contact you by electronic and paper mail.
@@ -366,7 +366,7 @@ If the program is interactive, make it output a short notice like this
 when it starts in an interactive mode:
 
 @smallexample
-Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
+Gnomovision version 69, Copyright (C) @var{year} @var{name of author}
 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
 type `show w'.  This is free software, and you are welcome
 to redistribute it under certain conditions; type `show c' 
@@ -418,19 +418,25 @@ closely integrated with the editing facilities; thus, editing commands
 are functions that can also conveniently be called from Lisp programs,
 and parameters for customization are ordinary Lisp variables.
 
-  This manual describes Emacs Lisp, presuming considerable familiarity
-with the use of Emacs for editing.  (See @cite{The GNU Emacs Manual}
-for this basic information.)  Generally speaking, the earlier chapters
-describe features of Emacs Lisp that have counterparts in many
-programming languages, and later chapters describe features that are
-peculiar to Emacs Lisp or relate specifically to editing.
+  This manual attempts to be a full description of Emacs Lisp.  For a
+beginner's introduction to Emacs Lisp, see @cite{An Introduction to
+Emacs Lisp Programming}, by Bob Chassell, also published by the Free
+Software Foundation.  This manual presumes considerable familiarity with
+the use of Emacs for editing; see @cite{The GNU Emacs Manual} for this
+basic information.
 
-  This is edition 2.3.
+  Generally speaking, the earlier chapters describe features of Emacs
+Lisp that have counterparts in many programming languages, and later
+chapters describe features that are peculiar to Emacs Lisp or relate
+specifically to editing.
+
+  This is edition 2.5.
 
 @menu
 * Caveats::             Flaws and a request for help.
 * Lisp History::        Emacs Lisp is descended from Maclisp.
 * Conventions::         How the manual is formatted.
+* Version Info::        Which Emacs version is running?
 * Acknowledgements::    The authors, editors, and sponsors of this manual.
 @end menu
 
@@ -452,8 +458,8 @@ or experiment to learn something not covered in the manual, then perhaps
 the manual should be fixed.  Please let us know.
 
 @iftex
-  As you use the manual, we ask that you mark pages with corrections so
-you can later look them up and send them in.  If you think of a simple,
+  As you use this manual, we ask that you mark pages with corrections so
+you can later look them up and send them to us.  If you think of a simple,
 real-life example for a function or group of functions, please make an
 effort to write it up and send it in.  Please reference any comments to
 the chapter name, section name, and function name, as appropriate, since
@@ -468,13 +474,13 @@ find them.  If you think of a simple, real life example for a function
 or group of functions, please make an effort to write it up and send it
 in.  Please reference any comments to the node name and function or
 variable name, as appropriate.  Also state the number of the edition
-which you are criticizing.
+you are criticizing.
 @end ifinfo
 
 Please mail comments and corrections to
 
 @example
-bug-lisp-manual@@prep.ai.mit.edu
+bug-lisp-manual@@gnu.org
 @end example
 
 @noindent
@@ -483,38 +489,45 @@ apply the corrections.  Months, and sometimes years, go by between
 updates.  So please attach no significance to the lack of a reply---your
 mail @emph{will} be acted on in due time.  If you want to contact the
 Emacs maintainers more quickly, send mail to
-@code{bug-gnu-emacs@@prep.ai.mit.edu}.
-
-@display
- --Bil Lewis, Dan LaLiberte, Richard Stallman
-@end display
+@code{bug-gnu-emacs@@gnu.org}.
 
 @node Lisp History
 @section Lisp History
 @cindex Lisp history
 
-  Lisp (LISt Processing language) was first developed in the late 1950's
+  Lisp (LISt Processing language) was first developed in the late 1950s
 at the Massachusetts Institute of Technology for research in artificial
-intelligence.  The great power of the Lisp language makes it superior
+intelligence.  The great power of the Lisp language makes it ideal
 for other purposes as well, such as writing editing commands.
 
 @cindex Maclisp
 @cindex Common Lisp
   Dozens of Lisp implementations have been built over the years, each
 with its own idiosyncrasies.  Many of them were inspired by Maclisp,
-which was written in the 1960's at MIT's Project MAC.  Eventually the
+which was written in the 1960s at MIT's Project MAC.  Eventually the
 implementors of the descendants of Maclisp came together and developed a
-standard for Lisp systems, called Common Lisp.
+standard for Lisp systems, called Common Lisp.  In the meantime, Gerry
+Sussman and Guy Steele at MIT developed a simplified but very powerful
+dialect of Lisp, called Scheme.
 
   GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common
 Lisp.  If you know Common Lisp, you will notice many similarities.
-However, many of the features of Common Lisp have been omitted or
+However, many features of Common Lisp have been omitted or
 simplified in order to reduce the memory requirements of GNU Emacs.
 Sometimes the simplifications are so drastic that a Common Lisp user
 might be very confused.  We will occasionally point out how GNU Emacs
 Lisp differs from Common Lisp.  If you don't know Common Lisp, don't
 worry about it; this manual is self-contained.
 
+@pindex cl
+  A certain amount of Common Lisp emulation is available via the
+@file{cl} library.  @xref{Top,, Common Lisp Extension, cl, Common Lisp
+Extensions}.
+
+  Emacs Lisp is not at all influenced by Scheme; but the GNU project has
+an implementation of Scheme, called Guile.  We use Guile in all new GNU
+software that calls for extensibility.
+
 @node Conventions
 @section Conventions
 
@@ -525,7 +538,7 @@ manual.  You may want to skip this section and refer back to it later.
 * Some Terms::               Explanation of terms we use in this manual.
 * nil and t::                How the symbols @code{nil} and @code{t} are used.
 * Evaluation Notation::      The format we use for examples of evaluation.
-* Printing Notation::        The format we use for examples that print output.
+* Printing Notation::        The format we use when examples print text.
 * Error Messages::           The format we use for examples of errors.
 * Buffer Text Notation::     The format we use for buffer contents in examples.
 * Format of Descriptions::   Notation for describing functions, variables, etc.
@@ -535,17 +548,17 @@ manual.  You may want to skip this section and refer back to it later.
 @subsection Some Terms
 
   Throughout this manual, the phrases ``the Lisp reader'' and ``the Lisp
-printer'' are used to refer to those routines in Lisp that convert
-textual representations of Lisp objects into actual Lisp objects, and vice
+printer'' refer to those routines in Lisp that convert textual
+representations of Lisp objects into actual Lisp objects, and vice
 versa.  @xref{Printed Representation}, for more details.  You, the
 person reading this manual, are thought of as ``the programmer'' and are
-addressed as ``you''.  ``The user'' is the person who uses Lisp programs,
-including those you write.
+addressed as ``you''.  ``The user'' is the person who uses Lisp
+programs, including those you write.
 
 @cindex fonts
-  Examples of Lisp code appear in this font or form: @code{(list 1 2
-3)}.  Names that represent arguments or metasyntactic variables appear
-in this font or form: @var{first-number}.
+  Examples of Lisp code are formatted like this: @code{(list 1 2 3)}.
+Names that represent metasyntactic variables, or arguments to a function
+being described, are formatted like this: @var{first-number}.
 
 @node nil and t
 @subsection @code{nil} and @code{t}
@@ -582,12 +595,14 @@ in Lisp programs also.
 is considered to be @var{true}.  However, @code{t} is the preferred way
 to represent the truth value @var{true}.  When you need to choose a
 value which represents @var{true}, and there is no other basis for
-choosing, use @code{t}.  The symbol @code{t} always has value @code{t}.
+choosing, use @code{t}.  The symbol @code{t} always has the value
+@code{t}.
 
   In Emacs Lisp, @code{nil} and @code{t} are special symbols that always
 evaluate to themselves.  This is so that you do not need to quote them
 to use them as constants in a program.  An attempt to change their
-values results in a @code{setting-constant} error.  @xref{Accessing
+values results in a @code{setting-constant} error.  The same is true of
+any symbol whose name starts with a colon (@samp{:}).  @xref{Constant
 Variables}.
 
 @node Evaluation Notation
@@ -609,7 +624,7 @@ You can read this as ``@code{(car '(1 2))} evaluates to 1''.
 
   When a form is a macro call, it expands into a new form for Lisp to
 evaluate.  We show the result of the expansion with
-@samp{@expansion{}}.  We may or may not show the actual result of the
+@samp{@expansion{}}.  We may or may not show the result of the
 evaluation of the expanded form.
 
 @example
@@ -662,20 +677,20 @@ the echo area.
 
 @example
 (+ 23 'x)
-@error{} Wrong type argument: integer-or-marker-p, x
+@error{} Wrong type argument: number-or-marker-p, x
 @end example
 
 @node Buffer Text Notation
 @subsection Buffer Text Notation
 @cindex buffer text notation
 
-  Some examples show modifications to text in a buffer, with ``before''
-and ``after'' versions of the text.  These examples show the contents of
-the buffer in question between two lines of dashes containing the buffer
-name.  In addition, @samp{@point{}} indicates the location of point.
-(The symbol for point, of course, is not part of the text in the buffer;
-it indicates the place @emph{between} two characters where point is
-located.)
+  Some examples describe modifications to the contents of a buffer, by
+showing the ``before'' and ``after'' versions of the text.  These
+examples show the contents of the buffer in question between two lines
+of dashes containing the buffer name.  In addition, @samp{@point{}}
+indicates the location of point.  (The symbol for point, of course, is
+not part of the text in the buffer; it indicates the place
+@emph{between} two characters where point is currently located.)
 
 @example
 ---------- Buffer: foo ----------
@@ -723,19 +738,20 @@ The description follows on succeeding lines, sometimes with examples.
 @cindex special form descriptions
 
   In a function description, the name of the function being described
-appears first.  It is followed on the same line by a list of parameters.
-The names used for the parameters are also used in the body of the
-description.
+appears first.  It is followed on the same line by a list of argument
+names.  These names are also used in the body of the description, to
+stand for the values of the arguments.
 
-  The appearance of the keyword @code{&optional} in the parameter list
-indicates that the arguments for subsequent parameters may be omitted
-(omitted parameters default to @code{nil}).  Do not write
-@code{&optional} when you call the function.
+  The appearance of the keyword @code{&optional} in the argument list
+indicates that the subsequent arguments may be omitted (omitted
+arguments default to @code{nil}).  Do not write @code{&optional} when
+you call the function.
 
-  The keyword @code{&rest} (which will always be followed by a single
-parameter) indicates that any number of arguments can follow.  The value
-of the single following parameter will be a list of all these arguments.
-Do not write @code{&rest} when you call the function.
+  The keyword @code{&rest} (which must be followed by a single argument
+name) indicates that any number of arguments can follow.  The single
+following argument name will have a value, as a variable, which is a
+list of all these remaining arguments.  Do not write @code{&rest} when
+you call the function.
 
   Here is a description of an imaginary function @code{foo}:
 
@@ -751,6 +767,7 @@ is not supplied, then the number 19 is used by default.
      @result{} 14
 @end example
 
+@need 1500
 More generally,
 
 @example
@@ -760,15 +777,15 @@ More generally,
 @end example
 @end defun
 
-  Any parameter whose name contains the name of a type (e.g.,
+  Any argument whose name contains the name of a type (e.g.,
 @var{integer}, @var{integer1} or @var{buffer}) is expected to be of that
 type.  A plural of a type (such as @var{buffers}) often means a list of
-objects of that type.  Parameters named @var{object} may be of any type.
-(@xref{Lisp Data Types}, for a list of Emacs object types.)
-Parameters with other sorts of names (e.g., @var{new-file}) are
-discussed specifically in the description of the function.  In some
-sections, features common to parameters of several functions are
-described at the beginning.
+objects of that type.  Arguments named @var{object} may be of any type.
+(@xref{Lisp Data Types}, for a list of Emacs object types.)  Arguments
+with other sorts of names (e.g., @var{new-file}) are discussed
+specifically in the description of the function.  In some sections,
+features common to the arguments of several functions are described at
+the beginning.
 
   @xref{Lambda Expressions}, for a more complete description of optional
 and rest arguments.
@@ -780,9 +797,9 @@ interactively; macros process their arguments differently from functions
 (the arguments are not evaluated), but are presented the same way.
 
   Special form descriptions use a more complex notation to specify
-optional and repeated parameters because they can break the argument
+optional and repeated arguments because they can break the argument
 list down into separate arguments in more complicated ways.
-@samp{@code{@r{[}@var{optional-arg}@r{]}}} means that @var{optional-arg} is
+@samp{@r{[}@var{optional-arg}@r{]}} means that @var{optional-arg} is
 optional and @samp{@var{repeated-args}@dots{}} stands for zero or more
 arguments.  Parentheses are used when several arguments are grouped into
 additional levels of list structure.  Here is an example:
@@ -791,17 +808,18 @@ additional levels of list structure.  Here is an example:
 This imaginary special form implements a loop that executes the
 @var{body} forms and then increments the variable @var{var} on each
 iteration.  On the first iteration, the variable has the value
-@var{from}; on subsequent iterations, it is incremented by 1 (or by
+@var{from}; on subsequent iterations, it is incremented by one (or by
 @var{inc} if that is given).  The loop exits before executing @var{body}
 if @var{var} equals @var{to}.  Here is an example:
 
 @example
 (count-loop (i 0 10)
   (prin1 i) (princ " ")
-  (prin1 (aref vector i)) (terpri))
+  (prin1 (aref vector i))
+  (terpri))
 @end example
 
-If @var{from} and @var{to} are omitted, then @var{var} is bound to
+If @var{from} and @var{to} are omitted, @var{var} is bound to
 @code{nil} before the loop begins, and the loop exits if @var{var} is
 non-@code{nil} at the beginning of an iteration.  Here is an example:
 
@@ -842,6 +860,62 @@ have not yet thought about executing.
   User option descriptions have the same format, but `Variable' is
 replaced by `User Option'.
 
+@node Version Info
+@section Version Information
+
+  These facilities provide information about which version of Emacs is
+in use.
+
+@deffn Command emacs-version
+This function returns a string describing the version of Emacs that is
+running.  It is useful to include this string in bug reports.
+
+@smallexample
+@group
+(emacs-version)
+  @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit)
+ of Sat Feb 14 1998 on psilocin.gnu.org"
+@end group
+@end smallexample
+
+Called interactively, the function prints the same information in the
+echo area.
+@end deffn
+
+@defvar emacs-build-time
+The value of this variable indicates the time at which Emacs was built
+at the local site.  It is a list of three integers, like the value
+of @code{current-time} (@pxref{Time of Day}).
+
+@example
+@group
+emacs-build-time
+     @result{} (13623 62065 344633)
+@end group
+@end example
+@end defvar
+
+@defvar emacs-version
+The value of this variable is the version of Emacs being run.  It is a
+string such as @code{"20.3.1"}.  The last number in this string is not
+really part of the Emacs release version number; it is incremented each
+time you build Emacs in any given directory.  A value with three numeric
+components, such as @code{"20.3.9.1"}, indicates an unreleased test
+version.
+@end defvar
+
+  The following two variables have existed since Emacs version 19.23:
+
+@defvar emacs-major-version
+The major version number of Emacs, as an integer.  For Emacs version
+20.3, the value is 20.
+@end defvar
+
+@defvar emacs-minor-version
+The minor version number of Emacs, as an integer.  For Emacs version
+20.3, the value is 3.
+@end defvar
+
 @node Acknowledgements
 @section Acknowledgements
 
@@ -850,7 +924,7 @@ Richard M. Stallman and Chris Welty, the volunteers of the GNU manual
 group, in an effort extending over several years.  Robert J. Chassell
 helped to review and edit the manual, with the support of the Defense
 Advanced Research Projects Agency, ARPA Order 6082, arranged by Warren
-A. Hunt, Jr. of Computational Logic, Inc.
+A. Hunt, Jr.@: of Computational Logic, Inc.
 
   Corrections were supplied by Karl Berry, Jim Blandy, Bard Bloom,
 Stephane Boucher, David Boyes, Alan Carroll, Richard Davis, Lawrence
@@ -861,6 +935,6 @@ Ida, Dan Jacobson, Jak Kirman, Bob Knighten, Frederick M. Korz, Joe
 Lammens, Glenn M. Lewis, K. Richard Magill, Brian Marick, Roland
 McGrath, Skip Montanaro, John Gardiner Myers, Thomas A. Peterson,
 Francesco Potorti, Friedrich Pukelsheim, Arnold D. Robbins, Raul
-Rockwell, Per Starback, Shinichirou Sugou, Kimmo Suominen, Edward Tharp,
+Rockwell, Per Starb@"ack, Shinichirou Sugou, Kimmo Suominen, Edward Tharp,
 Bill Trost, Rickard Westman, Jean White, Matthew Wilding, Carl Witty,
 Dale Worley, Rusty Wright, and David D. Zuhn.