aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXue Fuqiao2013-04-21 19:56:28 +0800
committerXue Fuqiao2013-04-21 19:56:28 +0800
commit767b8eaef5f62b5f93ef62fd692523b7da7b0914 (patch)
tree3412a1c84dd4fdeb1dc7172f6edd0a79d56b2a9f
parent84ebefe92fde8f636ceed2e51f6489876280be71 (diff)
downloademacs-767b8eaef5f62b5f93ef62fd692523b7da7b0914.tar.gz
emacs-767b8eaef5f62b5f93ef62fd692523b7da7b0914.zip
* emacs-lisp-intro.texi (defcustom, defun, simplified-beginning-of-buffer, defvar, Building Robots, Review, save-excursion): `defun' and `defcustom' are now macros rather than special forms. (Bug#13853)
-rw-r--r--doc/lispintro/ChangeLog7
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi47
2 files changed, 27 insertions, 27 deletions
diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog
index 93084e76203..1f27775442c 100644
--- a/doc/lispintro/ChangeLog
+++ b/doc/lispintro/ChangeLog
@@ -1,3 +1,10 @@
12013-04-21 Xue Fuqiao <xfq.free@gmail.com>
2
3 * emacs-lisp-intro.texi (defcustom, defun)
4 (simplified-beginning-of-buffer, defvar, Building Robots, Review)
5 (save-excursion): `defun' and `defcustom' are now macros rather
6 than special forms. (Bug#13853)
7
12013-03-16 Glenn Morris <rgm@gnu.org> 82013-03-16 Glenn Morris <rgm@gnu.org>
2 9
3 * emacs-lisp-intro.texi: Add some stuff specific to www.gnu.org. 10 * emacs-lisp-intro.texi: Add some stuff specific to www.gnu.org.
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index c42ed210cbc..3147960fbc3 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -37,6 +37,7 @@
37 37
38@set edition-number 3.10 38@set edition-number 3.10
39@set update-date 28 October 2009 39@set update-date 28 October 2009
40@c FIXME can this be updated? -- xfq
40 41
41@ignore 42@ignore
42 ## Summary of shell commands to create various output formats: 43 ## Summary of shell commands to create various output formats:
@@ -3094,18 +3095,15 @@ unless you investigate, you won't know whether an already-written
3094function is written in Emacs Lisp or C. 3095function is written in Emacs Lisp or C.
3095 3096
3096@node defun 3097@node defun
3097@section The @code{defun} Special Form 3098@section The @code{defun} Macro
3098@findex defun 3099@findex defun
3099@cindex Special form of @code{defun}
3100 3100
3101@cindex @samp{function definition} defined 3101@cindex @samp{function definition} defined
3102In Lisp, a symbol such as @code{mark-whole-buffer} has code attached to 3102In Lisp, a symbol such as @code{mark-whole-buffer} has code attached to
3103it that tells the computer what to do when the function is called. 3103it that tells the computer what to do when the function is called.
3104This code is called the @dfn{function definition} and is created by 3104This code is called the @dfn{function definition} and is created by
3105evaluating a Lisp expression that starts with the symbol @code{defun} 3105evaluating a Lisp expression that starts with the symbol @code{defun}
3106(which is an abbreviation for @emph{define function}). Because 3106(which is an abbreviation for @emph{define function}).
3107@code{defun} does not evaluate its arguments in the usual way, it is
3108called a @dfn{special form}.
3109 3107
3110In subsequent sections, we will look at function definitions from the 3108In subsequent sections, we will look at function definitions from the
3111Emacs source code, such as @code{mark-whole-buffer}. In this section, 3109Emacs source code, such as @code{mark-whole-buffer}. In this section,
@@ -4254,7 +4252,7 @@ On the other hand, this function returns @code{nil} if the test is false.
4254@findex point 4252@findex point
4255@findex mark 4253@findex mark
4256 4254
4257The @code{save-excursion} function is the fourth and final special form 4255The @code{save-excursion} function is the third and final special form
4258that we will discuss in this chapter. 4256that we will discuss in this chapter.
4259 4257
4260In Emacs Lisp programs used for editing, the @code{save-excursion} 4258In Emacs Lisp programs used for editing, the @code{save-excursion}
@@ -4381,9 +4379,9 @@ within the body of a @code{let} expression. It looks like this:
4381@node Review 4379@node Review
4382@section Review 4380@section Review
4383 4381
4384In the last few chapters we have introduced a fair number of functions 4382In the last few chapters we have introduced a macro and a fair number
4385and special forms. Here they are described in brief, along with a few 4383of functions and special forms. Here they are described in brief,
4386similar functions that have not been mentioned yet. 4384along with a few similar functions that have not been mentioned yet.
4387 4385
4388@table @code 4386@table @code
4389@item eval-last-sexp 4387@item eval-last-sexp
@@ -4393,10 +4391,10 @@ invoked with an argument; in that case, the output is printed in the
4393current buffer. This command is normally bound to @kbd{C-x C-e}. 4391current buffer. This command is normally bound to @kbd{C-x C-e}.
4394 4392
4395@item defun 4393@item defun
4396Define function. This special form has up to five parts: the name, 4394Define function. This macro has up to five parts: the name, a
4397a template for the arguments that will be passed to the function, 4395template for the arguments that will be passed to the function,
4398documentation, an optional interactive declaration, and the body of the 4396documentation, an optional interactive declaration, and the body of
4399definition. 4397the definition.
4400 4398
4401@need 1250 4399@need 1250
4402For example, in an early version of Emacs, the function definition was 4400For example, in an early version of Emacs, the function definition was
@@ -4803,7 +4801,7 @@ leave mark at previous position."
4803@end smallexample 4801@end smallexample
4804 4802
4805Like all function definitions, this definition has five parts following 4803Like all function definitions, this definition has five parts following
4806the special form @code{defun}: 4804the macro @code{defun}:
4807 4805
4808@enumerate 4806@enumerate
4809@item 4807@item
@@ -9293,10 +9291,6 @@ have a value. If the variable already has a value, @code{defvar} does
9293not override the existing value. Second, @code{defvar} has a 9291not override the existing value. Second, @code{defvar} has a
9294documentation string. 9292documentation string.
9295 9293
9296(Another special form, @code{defcustom}, is designed for variables
9297that people customize. It has more features than @code{defvar}.
9298(@xref{defcustom, , Setting Variables with @code{defcustom}}.)
9299
9300@menu 9294@menu
9301* See variable current value:: 9295* See variable current value::
9302* defvar and asterisk:: 9296* defvar and asterisk::
@@ -11300,11 +11294,11 @@ Let's expand on the metaphor in which a computer program is a robot.
11300 11294
11301A function definition provides the blueprints for a robot. When you 11295A function definition provides the blueprints for a robot. When you
11302install a function definition, that is, when you evaluate a 11296install a function definition, that is, when you evaluate a
11303@code{defun} special form, you install the necessary equipment to 11297@code{defun} macro, you install the necessary equipment to build
11304build robots. It is as if you were in a factory, setting up an 11298robots. It is as if you were in a factory, setting up an assembly
11305assembly line. Robots with the same name are built according to the 11299line. Robots with the same name are built according to the same
11306same blueprints. So they have, as it were, the same `model number', 11300blueprints. So they have, as it were, the same `model number', but a
11307but a different `serial number'. 11301different `serial number'.
11308 11302
11309We often say that a recursive function `calls itself'. What we mean 11303We often say that a recursive function `calls itself'. What we mean
11310is that the instructions in a recursive function cause the Lisp 11304is that the instructions in a recursive function cause the Lisp
@@ -16971,10 +16965,9 @@ definitions; but you can write @code{defuns} in your @file{.emacs}
16971file. Indeed, you can write any Lisp expression in your @file{.emacs} 16965file. Indeed, you can write any Lisp expression in your @file{.emacs}
16972file.) 16966file.)
16973 16967
16974The @code{customize} feature depends on the @code{defcustom} special 16968The @code{customize} feature depends on the @code{defcustom} macro.
16975form. Although you can use @code{defvar} or @code{setq} for variables 16969Although you can use @code{defvar} or @code{setq} for variables that
16976that users set, the @code{defcustom} special form is designed for the 16970users set, the @code{defcustom} macro is designed for the job.
16977job.
16978 16971
16979You can use your knowledge of @code{defvar} for writing the 16972You can use your knowledge of @code{defvar} for writing the
16980first three arguments for @code{defcustom}. The first argument to 16973first three arguments for @code{defcustom}. The first argument to