diff options
| author | Stefan Monnier | 2012-06-18 11:57:41 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-06-18 11:57:41 -0400 |
| commit | 1053a8716ba9f1834eccff14ece377928a4bd244 (patch) | |
| tree | 775e64585480452dcaa629ee9ffa2b85505d3e01 /doc | |
| parent | b7e8d081674c24b19c5ee39892a72aef25c1dfcc (diff) | |
| download | emacs-1053a8716ba9f1834eccff14ece377928a4bd244.tar.gz emacs-1053a8716ba9f1834eccff14ece377928a4bd244.zip | |
Fix return value of `defun' and un-define it.
* src/data.c (Fdefalias): Return `symbol'.
* doc/lispref/functions.texi (Defining Functions):
* doc/lispref/macros.texi (Defining Macros): Un-define the return value of
`defun', `defmacro' and `defalias'.
Fixes: debbugs:11686
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/functions.texi | 18 | ||||
| -rw-r--r-- | doc/lispref/macros.texi | 9 |
3 files changed, 10 insertions, 23 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 0439cf2be57..89efb5c6255 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-06-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * functions.texi (Defining Functions): | ||
| 4 | * macros.texi (Defining Macros): Un-define the return value of `defun', | ||
| 5 | `defmacro' and `defalias'. | ||
| 6 | |||
| 1 | 2012-06-17 Chong Yidong <cyd@gnu.org> | 7 | 2012-06-17 Chong Yidong <cyd@gnu.org> |
| 2 | 8 | ||
| 3 | * elisp.texi: Remove urlcolor setting. | 9 | * elisp.texi: Remove urlcolor setting. |
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 5fba243f65f..ab2789b5e6d 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi | |||
| @@ -530,8 +530,7 @@ defines the symbol @var{name} as a function that looks like this: | |||
| 530 | @end example | 530 | @end example |
| 531 | 531 | ||
| 532 | @code{defun} stores this lambda expression in the function cell of | 532 | @code{defun} stores this lambda expression in the function cell of |
| 533 | @var{name}. It returns the value @var{name}, but usually we ignore this | 533 | @var{name}. Its return value is @emph{undefined}. |
| 534 | value. | ||
| 535 | 534 | ||
| 536 | As described previously, @var{argument-list} is a list of argument | 535 | As described previously, @var{argument-list} is a list of argument |
| 537 | names and may include the keywords @code{&optional} and @code{&rest}. | 536 | names and may include the keywords @code{&optional} and @code{&rest}. |
| @@ -543,9 +542,6 @@ Here are some examples: | |||
| 543 | @example | 542 | @example |
| 544 | @group | 543 | @group |
| 545 | (defun foo () 5) | 544 | (defun foo () 5) |
| 546 | @result{} foo | ||
| 547 | @end group | ||
| 548 | @group | ||
| 549 | (foo) | 545 | (foo) |
| 550 | @result{} 5 | 546 | @result{} 5 |
| 551 | @end group | 547 | @end group |
| @@ -553,9 +549,6 @@ Here are some examples: | |||
| 553 | @group | 549 | @group |
| 554 | (defun bar (a &optional b &rest c) | 550 | (defun bar (a &optional b &rest c) |
| 555 | (list a b c)) | 551 | (list a b c)) |
| 556 | @result{} bar | ||
| 557 | @end group | ||
| 558 | @group | ||
| 559 | (bar 1 2 3 4 5) | 552 | (bar 1 2 3 4 5) |
| 560 | @result{} (1 2 (3 4 5)) | 553 | @result{} (1 2 (3 4 5)) |
| 561 | @end group | 554 | @end group |
| @@ -576,7 +569,6 @@ Here are some examples: | |||
| 576 | (forward-word 1) | 569 | (forward-word 1) |
| 577 | (backward-char 1) | 570 | (backward-char 1) |
| 578 | (capitalize-word 1)) | 571 | (capitalize-word 1)) |
| 579 | @result{} capitalize-backwards | ||
| 580 | @end group | 572 | @end group |
| 581 | @end example | 573 | @end example |
| 582 | 574 | ||
| @@ -593,7 +585,7 @@ redefinition from unintentional redefinition. | |||
| 593 | @anchor{Definition of defalias} | 585 | @anchor{Definition of defalias} |
| 594 | This special form defines the symbol @var{name} as a function, with | 586 | This special form defines the symbol @var{name} as a function, with |
| 595 | definition @var{definition} (which can be any valid Lisp function). | 587 | definition @var{definition} (which can be any valid Lisp function). |
| 596 | It returns @var{definition}. | 588 | Its return value is @emph{undefined}. |
| 597 | 589 | ||
| 598 | If @var{docstring} is non-@code{nil}, it becomes the function | 590 | If @var{docstring} is non-@code{nil}, it becomes the function |
| 599 | documentation of @var{name}. Otherwise, any documentation provided by | 591 | documentation of @var{name}. Otherwise, any documentation provided by |
| @@ -1015,9 +1007,6 @@ function. | |||
| 1015 | @example | 1007 | @example |
| 1016 | @group | 1008 | @group |
| 1017 | (defun bar (n) (+ n 2)) | 1009 | (defun bar (n) (+ n 2)) |
| 1018 | @result{} bar | ||
| 1019 | @end group | ||
| 1020 | @group | ||
| 1021 | (symbol-function 'bar) | 1010 | (symbol-function 'bar) |
| 1022 | @result{} (lambda (n) (+ n 2)) | 1011 | @result{} (lambda (n) (+ n 2)) |
| 1023 | @end group | 1012 | @end group |
| @@ -1063,9 +1052,6 @@ subsequent attempt to access this cell will cause a | |||
| 1063 | @example | 1052 | @example |
| 1064 | @group | 1053 | @group |
| 1065 | (defun foo (x) x) | 1054 | (defun foo (x) x) |
| 1066 | @result{} foo | ||
| 1067 | @end group | ||
| 1068 | @group | ||
| 1069 | (foo 1) | 1055 | (foo 1) |
| 1070 | @result{}1 | 1056 | @result{}1 |
| 1071 | @end group | 1057 | @end group |
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi index b9b0e03c65a..efe298bf647 100644 --- a/doc/lispref/macros.texi +++ b/doc/lispref/macros.texi | |||
| @@ -113,7 +113,6 @@ uses this feature. | |||
| 113 | @group | 113 | @group |
| 114 | (defmacro inc (var) | 114 | (defmacro inc (var) |
| 115 | (list 'setq var (list '1+ var))) | 115 | (list 'setq var (list '1+ var))) |
| 116 | @result{} inc | ||
| 117 | @end group | 116 | @end group |
| 118 | 117 | ||
| 119 | @group | 118 | @group |
| @@ -124,7 +123,6 @@ uses this feature. | |||
| 124 | @group | 123 | @group |
| 125 | (defmacro inc2 (var1 var2) | 124 | (defmacro inc2 (var1 var2) |
| 126 | (list 'progn (list 'inc var1) (list 'inc var2))) | 125 | (list 'progn (list 'inc var1) (list 'inc var2))) |
| 127 | @result{} inc2 | ||
| 128 | @end group | 126 | @end group |
| 129 | 127 | ||
| 130 | @group | 128 | @group |
| @@ -207,9 +205,8 @@ like this: | |||
| 207 | @end example | 205 | @end example |
| 208 | 206 | ||
| 209 | (Note that the @sc{cdr} of this list is a function---a lambda expression.) | 207 | (Note that the @sc{cdr} of this list is a function---a lambda expression.) |
| 210 | This macro object is stored in the function cell of @var{name}. The | 208 | This macro object is stored in the function cell of @var{name}. Its return |
| 211 | value returned by evaluating the @code{defmacro} form is @var{name}, but | 209 | value is @emph{undefined}. |
| 212 | usually we ignore this value. | ||
| 213 | 210 | ||
| 214 | The shape and meaning of @var{argument-list} is the same as in a | 211 | The shape and meaning of @var{argument-list} is the same as in a |
| 215 | function, and the keywords @code{&rest} and @code{&optional} may be used | 212 | function, and the keywords @code{&rest} and @code{&optional} may be used |
| @@ -342,7 +339,6 @@ For example, (for i from 1 to 10 do (print i))." | |||
| 342 | (cons (list '<= var final) | 339 | (cons (list '<= var final) |
| 343 | (append body (list (list 'inc var))))))) | 340 | (append body (list (list 'inc var))))))) |
| 344 | @end group | 341 | @end group |
| 345 | @result{} for | ||
| 346 | 342 | ||
| 347 | @group | 343 | @group |
| 348 | (for i from 1 to 3 do | 344 | (for i from 1 to 3 do |
| @@ -512,7 +508,6 @@ it. Here is an example: | |||
| 512 | @group | 508 | @group |
| 513 | (defmacro foo (a) | 509 | (defmacro foo (a) |
| 514 | (list 'setq (eval a) t)) | 510 | (list 'setq (eval a) t)) |
| 515 | @result{} foo | ||
| 516 | @end group | 511 | @end group |
| 517 | @group | 512 | @group |
| 518 | (setq x 'b) | 513 | (setq x 'b) |