comparison lispref/intro.texi @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 23a1cea22d13
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual. 2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 2002 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 2002, 2003, 2004,
4 @c Free Software Foundation, Inc. 4 @c 2005 Free Software Foundation, Inc.
5 @c See the file elisp.texi for copying conditions. 5 @c See the file elisp.texi for copying conditions.
6 @setfilename ../info/intro 6 @setfilename ../info/intro
7
8 @c Versino of the manual.
9 @set VERSION 2.9
10 7
11 @node Introduction, Lisp Data Types, Top, Top 8 @node Introduction, Lisp Data Types, Top, Top
12 @comment node-name, next, previous, up 9 @comment node-name, next, previous, up
13 @chapter Introduction 10 @chapter Introduction
14 11
36 Generally speaking, the earlier chapters describe features of Emacs 33 Generally speaking, the earlier chapters describe features of Emacs
37 Lisp that have counterparts in many programming languages, and later 34 Lisp that have counterparts in many programming languages, and later
38 chapters describe features that are peculiar to Emacs Lisp or relate 35 chapters describe features that are peculiar to Emacs Lisp or relate
39 specifically to editing. 36 specifically to editing.
40 37
41 This is edition @value{VERSION}. 38 This is edition @value{VERSION} of the GNU Emacs Lisp Reference
39 Manual, corresponding to Emacs version @value{EMACSVER}.
42 40
43 @menu 41 @menu
44 * Caveats:: Flaws and a request for help. 42 * Caveats:: Flaws and a request for help.
45 * Lisp History:: Emacs Lisp is descended from Maclisp. 43 * Lisp History:: Emacs Lisp is descended from Maclisp.
46 * Conventions:: How the manual is formatted. 44 * Conventions:: How the manual is formatted.
130 Lisp differs from Common Lisp. If you don't know Common Lisp, don't 128 Lisp differs from Common Lisp. If you don't know Common Lisp, don't
131 worry about it; this manual is self-contained. 129 worry about it; this manual is self-contained.
132 130
133 @pindex cl 131 @pindex cl
134 A certain amount of Common Lisp emulation is available via the 132 A certain amount of Common Lisp emulation is available via the
135 @file{cl} library. @xref{Top,, Common Lisp Extension, cl, Common Lisp 133 @file{cl} library. @inforef{Top, Overview, cl}.
136 Extensions}.
137 134
138 Emacs Lisp is not at all influenced by Scheme; but the GNU project has 135 Emacs Lisp is not at all influenced by Scheme; but the GNU project has
139 an implementation of Scheme, called Guile. We use Guile in all new GNU 136 an implementation of Scheme, called Guile. We use Guile in all new GNU
140 software that calls for extensibility. 137 software that calls for extensibility.
141 138
198 @example 195 @example
199 (cons 'foo ()) ; @r{Emphasize the empty list} 196 (cons 'foo ()) ; @r{Emphasize the empty list}
200 (not nil) ; @r{Emphasize the truth value @var{false}} 197 (not nil) ; @r{Emphasize the truth value @var{false}}
201 @end example 198 @end example
202 199
203 @cindex @code{t} and truth 200 @cindex @code{t}, uses of
204 @cindex true 201 @cindex true
205 In contexts where a truth value is expected, any non-@code{nil} value 202 In contexts where a truth value is expected, any non-@code{nil} value
206 is considered to be @var{true}. However, @code{t} is the preferred way 203 is considered to be @var{true}. However, @code{t} is the preferred way
207 to represent the truth value @var{true}. When you need to choose a 204 to represent the truth value @var{true}. When you need to choose a
208 value which represents @var{true}, and there is no other basis for 205 value which represents @var{true}, and there is no other basis for
210 @code{t}. 207 @code{t}.
211 208
212 In Emacs Lisp, @code{nil} and @code{t} are special symbols that always 209 In Emacs Lisp, @code{nil} and @code{t} are special symbols that always
213 evaluate to themselves. This is so that you do not need to quote them 210 evaluate to themselves. This is so that you do not need to quote them
214 to use them as constants in a program. An attempt to change their 211 to use them as constants in a program. An attempt to change their
215 values results in a @code{setting-constant} error. The same is true of 212 values results in a @code{setting-constant} error. @xref{Constant
216 any symbol whose name starts with a colon (@samp{:}). @xref{Constant
217 Variables}. 213 Variables}.
218 214
219 @node Evaluation Notation 215 @node Evaluation Notation
220 @subsection Evaluation Notation 216 @subsection Evaluation Notation
221 @cindex evaluation notation 217 @cindex evaluation notation
222 @cindex documentation notation 218 @cindex documentation notation
219 @cindex notation
223 220
224 A Lisp expression that you can evaluate is called a @dfn{form}. 221 A Lisp expression that you can evaluate is called a @dfn{form}.
225 Evaluating a form always produces a result, which is a Lisp object. In 222 Evaluating a form always produces a result, which is a Lisp object. In
226 the examples in this manual, this is indicated with @samp{@result{}}: 223 the examples in this manual, this is indicated with @samp{@result{}}:
227 224
262 the buffer. If you execute the example by other means (such as by 259 the buffer. If you execute the example by other means (such as by
263 evaluating the function @code{eval-region}), the printed text is 260 evaluating the function @code{eval-region}), the printed text is
264 displayed in the echo area. 261 displayed in the echo area.
265 262
266 Examples in this manual indicate printed text with @samp{@print{}}, 263 Examples in this manual indicate printed text with @samp{@print{}},
267 irrespective of where that text goes. The value returned by evaluating 264 irrespective of where that text goes. The value returned by
268 the form (here @code{bar}) follows on a separate line. 265 evaluating the form (here @code{bar}) follows on a separate line with
266 @samp{@result{}}.
269 267
270 @example 268 @example
271 @group 269 @group
272 (progn (print 'foo) (print 'bar)) 270 (progn (prin1 'foo) (princ "\n") (prin1 'bar))
273 @print{} foo 271 @print{} foo
274 @print{} bar 272 @print{} bar
275 @result{} bar 273 @result{} bar
276 @end group 274 @end group
277 @end example 275 @end example
355 The appearance of the keyword @code{&optional} in the argument list 353 The appearance of the keyword @code{&optional} in the argument list
356 indicates that the subsequent arguments may be omitted (omitted 354 indicates that the subsequent arguments may be omitted (omitted
357 arguments default to @code{nil}). Do not write @code{&optional} when 355 arguments default to @code{nil}). Do not write @code{&optional} when
358 you call the function. 356 you call the function.
359 357
360 The keyword @code{&rest} (which must be followed by a single argument 358 The keyword @code{&rest} (which must be followed by a single
361 name) indicates that any number of arguments can follow. The single 359 argument name) indicates that any number of arguments can follow. The
362 following argument name will have a value, as a variable, which is a 360 single argument name following @code{&rest} will receive, as its
363 list of all these remaining arguments. Do not write @code{&rest} when 361 value, a list of all the remaining arguments passed to the function.
364 you call the function. 362 Do not write @code{&rest} when you call the function.
365 363
366 Here is a description of an imaginary function @code{foo}: 364 Here is a description of an imaginary function @code{foo}:
367 365
368 @defun foo integer1 &optional integer2 &rest integers 366 @defun foo integer1 &optional integer2 &rest integers
369 The function @code{foo} subtracts @var{integer1} from @var{integer2}, 367 The function @code{foo} subtracts @var{integer1} from @var{integer2},
450 @node A Sample Variable Description 448 @node A Sample Variable Description
451 @subsubsection A Sample Variable Description 449 @subsubsection A Sample Variable Description
452 @cindex variable descriptions 450 @cindex variable descriptions
453 @cindex option descriptions 451 @cindex option descriptions
454 452
455 A @dfn{variable} is a name that can hold a value. Although any 453 A @dfn{variable} is a name that can hold a value. Although nearly
456 variable can be set by the user, certain variables that exist 454 all variables can be set by the user, certain variables exist
457 specifically so that users can change them are called @dfn{user 455 specifically so that users can change them; these are called @dfn{user
458 options}. Ordinary variables and user options are described using a 456 options}. Ordinary variables and user options are described using a
459 format like that for functions except that there are no arguments. 457 format like that for functions except that there are no arguments.
460 458
461 Here is a description of the imaginary @code{electric-future-map} 459 Here is a description of the imaginary @code{electric-future-map}
462 variable.@refill 460 variable.@refill
474 @section Version Information 472 @section Version Information
475 473
476 These facilities provide information about which version of Emacs is 474 These facilities provide information about which version of Emacs is
477 in use. 475 in use.
478 476
479 @deffn Command emacs-version 477 @deffn Command emacs-version &optional here
480 This function returns a string describing the version of Emacs that is 478 This function returns a string describing the version of Emacs that is
481 running. It is useful to include this string in bug reports. 479 running. It is useful to include this string in bug reports.
482 480
483 @smallexample 481 @smallexample
484 @group 482 @group
486 @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit) 484 @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit)
487 of Sat Feb 14 1998 on psilocin.gnu.org" 485 of Sat Feb 14 1998 on psilocin.gnu.org"
488 @end group 486 @end group
489 @end smallexample 487 @end smallexample
490 488
491 Called interactively, the function prints the same information in the 489 If @var{here} is non-@code{nil}, it inserts the text in the buffer
492 echo area. 490 before point, and returns @code{nil}. Called interactively, the
491 function prints the same information in the echo area, but giving a
492 prefix argument makes @var{here} non-@code{nil}.
493 @end deffn 493 @end deffn
494 494
495 @defvar emacs-build-time 495 @defvar emacs-build-time
496 The value of this variable indicates the time at which Emacs was built 496 The value of this variable indicates the time at which Emacs was built
497 at the local site. It is a list of three integers, like the value 497 at the local site. It is a list of three integers, like the value
546 McGrath, Skip Montanaro, John Gardiner Myers, Thomas A. Peterson, 546 McGrath, Skip Montanaro, John Gardiner Myers, Thomas A. Peterson,
547 Francesco Potorti, Friedrich Pukelsheim, Arnold D. Robbins, Raul 547 Francesco Potorti, Friedrich Pukelsheim, Arnold D. Robbins, Raul
548 Rockwell, Per Starb@"ack, Shinichirou Sugou, Kimmo Suominen, Edward Tharp, 548 Rockwell, Per Starb@"ack, Shinichirou Sugou, Kimmo Suominen, Edward Tharp,
549 Bill Trost, Rickard Westman, Jean White, Matthew Wilding, Carl Witty, 549 Bill Trost, Rickard Westman, Jean White, Matthew Wilding, Carl Witty,
550 Dale Worley, Rusty Wright, and David D. Zuhn. 550 Dale Worley, Rusty Wright, and David D. Zuhn.
551
552 @ignore
553 arch-tag: d156593f-82f8-4708-a844-204e48f7f2aa
554 @end ignore