diff options
| author | Xue Fuqiao | 2013-04-21 19:56:28 +0800 |
|---|---|---|
| committer | Xue Fuqiao | 2013-04-21 19:56:28 +0800 |
| commit | 767b8eaef5f62b5f93ef62fd692523b7da7b0914 (patch) | |
| tree | 3412a1c84dd4fdeb1dc7172f6edd0a79d56b2a9f | |
| parent | 84ebefe92fde8f636ceed2e51f6489876280be71 (diff) | |
| download | emacs-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/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 47 |
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 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-03-16 Glenn Morris <rgm@gnu.org> | 8 | 2013-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 | |||
| 3094 | function is written in Emacs Lisp or C. | 3095 | function 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 |
| 3102 | In Lisp, a symbol such as @code{mark-whole-buffer} has code attached to | 3102 | In Lisp, a symbol such as @code{mark-whole-buffer} has code attached to |
| 3103 | it that tells the computer what to do when the function is called. | 3103 | it that tells the computer what to do when the function is called. |
| 3104 | This code is called the @dfn{function definition} and is created by | 3104 | This code is called the @dfn{function definition} and is created by |
| 3105 | evaluating a Lisp expression that starts with the symbol @code{defun} | 3105 | evaluating 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 | ||
| 3108 | called a @dfn{special form}. | ||
| 3109 | 3107 | ||
| 3110 | In subsequent sections, we will look at function definitions from the | 3108 | In subsequent sections, we will look at function definitions from the |
| 3111 | Emacs source code, such as @code{mark-whole-buffer}. In this section, | 3109 | Emacs 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 | ||
| 4257 | The @code{save-excursion} function is the fourth and final special form | 4255 | The @code{save-excursion} function is the third and final special form |
| 4258 | that we will discuss in this chapter. | 4256 | that we will discuss in this chapter. |
| 4259 | 4257 | ||
| 4260 | In Emacs Lisp programs used for editing, the @code{save-excursion} | 4258 | In 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 | ||
| 4384 | In the last few chapters we have introduced a fair number of functions | 4382 | In the last few chapters we have introduced a macro and a fair number |
| 4385 | and special forms. Here they are described in brief, along with a few | 4383 | of functions and special forms. Here they are described in brief, |
| 4386 | similar functions that have not been mentioned yet. | 4384 | along 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 | |||
| 4393 | current buffer. This command is normally bound to @kbd{C-x C-e}. | 4391 | current buffer. This command is normally bound to @kbd{C-x C-e}. |
| 4394 | 4392 | ||
| 4395 | @item defun | 4393 | @item defun |
| 4396 | Define function. This special form has up to five parts: the name, | 4394 | Define function. This macro has up to five parts: the name, a |
| 4397 | a template for the arguments that will be passed to the function, | 4395 | template for the arguments that will be passed to the function, |
| 4398 | documentation, an optional interactive declaration, and the body of the | 4396 | documentation, an optional interactive declaration, and the body of |
| 4399 | definition. | 4397 | the definition. |
| 4400 | 4398 | ||
| 4401 | @need 1250 | 4399 | @need 1250 |
| 4402 | For example, in an early version of Emacs, the function definition was | 4400 | For 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 | ||
| 4805 | Like all function definitions, this definition has five parts following | 4803 | Like all function definitions, this definition has five parts following |
| 4806 | the special form @code{defun}: | 4804 | the 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 | |||
| 9293 | not override the existing value. Second, @code{defvar} has a | 9291 | not override the existing value. Second, @code{defvar} has a |
| 9294 | documentation string. | 9292 | documentation string. |
| 9295 | 9293 | ||
| 9296 | (Another special form, @code{defcustom}, is designed for variables | ||
| 9297 | that 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 | ||
| 11301 | A function definition provides the blueprints for a robot. When you | 11295 | A function definition provides the blueprints for a robot. When you |
| 11302 | install a function definition, that is, when you evaluate a | 11296 | install 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 |
| 11304 | build robots. It is as if you were in a factory, setting up an | 11298 | robots. It is as if you were in a factory, setting up an assembly |
| 11305 | assembly line. Robots with the same name are built according to the | 11299 | line. Robots with the same name are built according to the same |
| 11306 | same blueprints. So they have, as it were, the same `model number', | 11300 | blueprints. So they have, as it were, the same `model number', but a |
| 11307 | but a different `serial number'. | 11301 | different `serial number'. |
| 11308 | 11302 | ||
| 11309 | We often say that a recursive function `calls itself'. What we mean | 11303 | We often say that a recursive function `calls itself'. What we mean |
| 11310 | is that the instructions in a recursive function cause the Lisp | 11304 | is 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} | |||
| 16971 | file. Indeed, you can write any Lisp expression in your @file{.emacs} | 16965 | file. Indeed, you can write any Lisp expression in your @file{.emacs} |
| 16972 | file.) | 16966 | file.) |
| 16973 | 16967 | ||
| 16974 | The @code{customize} feature depends on the @code{defcustom} special | 16968 | The @code{customize} feature depends on the @code{defcustom} macro. |
| 16975 | form. Although you can use @code{defvar} or @code{setq} for variables | 16969 | Although you can use @code{defvar} or @code{setq} for variables that |
| 16976 | that users set, the @code{defcustom} special form is designed for the | 16970 | users set, the @code{defcustom} macro is designed for the job. |
| 16977 | job. | ||
| 16978 | 16971 | ||
| 16979 | You can use your knowledge of @code{defvar} for writing the | 16972 | You can use your knowledge of @code{defvar} for writing the |
| 16980 | first three arguments for @code{defcustom}. The first argument to | 16973 | first three arguments for @code{defcustom}. The first argument to |