diff options
| author | Stefan Monnier | 2012-11-20 15:06:17 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2012-11-20 15:06:17 -0500 |
| commit | eadf1faa3cb5eea8c25a5166a9a97ebd63525c56 (patch) | |
| tree | c5b92de52e664400cbc79f7dd344cbf440fb7e2a /src/data.c | |
| parent | 2e31777bd1354d22319cf6de4085ccc362cff42c (diff) | |
| download | emacs-eadf1faa3cb5eea8c25a5166a9a97ebd63525c56.tar.gz emacs-eadf1faa3cb5eea8c25a5166a9a97ebd63525c56.zip | |
Conflate Qnil and Qunbound for `symbol-function'.
* src/alloc.c (Fmake_symbol): Initialize `function' to Qnil.
* src/lread.c (init_obarray): Set `function' fields to Qnil.
* src/eval.c (Fcommandp): Ignore Qunbound.
(Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand):
* src/data.c (Ffset, Ffboundp, indirect_function, Findirect_function):
Test NILP rather than Qunbound.
(Ffmakunbound): Set to Qnil.
(Fsymbol_function): Never signal an error.
(Finteractive_form): Ignore Qunbound.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/data.c b/src/data.c index 09899400b68..5fc6afaaa03 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -543,12 +543,13 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, | |||
| 543 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); | 543 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | /* FIXME: Make it an alias for function-symbol! */ | ||
| 546 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, | 547 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, |
| 547 | doc: /* Return t if SYMBOL's function definition is not void. */) | 548 | doc: /* Return t if SYMBOL's function definition is not void. */) |
| 548 | (register Lisp_Object symbol) | 549 | (register Lisp_Object symbol) |
| 549 | { | 550 | { |
| 550 | CHECK_SYMBOL (symbol); | 551 | CHECK_SYMBOL (symbol); |
| 551 | return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt; | 552 | return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt; |
| 552 | } | 553 | } |
| 553 | 554 | ||
| 554 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, | 555 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, |
| @@ -564,14 +565,14 @@ Return SYMBOL. */) | |||
| 564 | } | 565 | } |
| 565 | 566 | ||
| 566 | DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, | 567 | DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, |
| 567 | doc: /* Make SYMBOL's function definition be void. | 568 | doc: /* Make SYMBOL's function definition be nil. |
| 568 | Return SYMBOL. */) | 569 | Return SYMBOL. */) |
| 569 | (register Lisp_Object symbol) | 570 | (register Lisp_Object symbol) |
| 570 | { | 571 | { |
| 571 | CHECK_SYMBOL (symbol); | 572 | CHECK_SYMBOL (symbol); |
| 572 | if (NILP (symbol) || EQ (symbol, Qt)) | 573 | if (NILP (symbol) || EQ (symbol, Qt)) |
| 573 | xsignal1 (Qsetting_constant, symbol); | 574 | xsignal1 (Qsetting_constant, symbol); |
| 574 | set_symbol_function (symbol, Qunbound); | 575 | set_symbol_function (symbol, Qnil); |
| 575 | return symbol; | 576 | return symbol; |
| 576 | } | 577 | } |
| 577 | 578 | ||
| @@ -580,9 +581,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, | |||
| 580 | (register Lisp_Object symbol) | 581 | (register Lisp_Object symbol) |
| 581 | { | 582 | { |
| 582 | CHECK_SYMBOL (symbol); | 583 | CHECK_SYMBOL (symbol); |
| 583 | if (!EQ (XSYMBOL (symbol)->function, Qunbound)) | ||
| 584 | return XSYMBOL (symbol)->function; | 584 | return XSYMBOL (symbol)->function; |
| 585 | xsignal1 (Qvoid_function, symbol); | ||
| 586 | } | 585 | } |
| 587 | 586 | ||
| 588 | DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, | 587 | DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, |
| @@ -613,7 +612,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |||
| 613 | 612 | ||
| 614 | function = XSYMBOL (symbol)->function; | 613 | function = XSYMBOL (symbol)->function; |
| 615 | 614 | ||
| 616 | if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) | 615 | if (!NILP (Vautoload_queue) && !NILP (function)) |
| 617 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); | 616 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); |
| 618 | 617 | ||
| 619 | if (AUTOLOADP (function)) | 618 | if (AUTOLOADP (function)) |
| @@ -714,7 +713,7 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 714 | { | 713 | { |
| 715 | Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ | 714 | Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ |
| 716 | 715 | ||
| 717 | if (NILP (fun) || EQ (fun, Qunbound)) | 716 | if (NILP (fun)) |
| 718 | return Qnil; | 717 | return Qnil; |
| 719 | 718 | ||
| 720 | /* Use an `interactive-form' property if present, analogous to the | 719 | /* Use an `interactive-form' property if present, analogous to the |
| @@ -2008,10 +2007,10 @@ indirect_function (register Lisp_Object object) | |||
| 2008 | 2007 | ||
| 2009 | for (;;) | 2008 | for (;;) |
| 2010 | { | 2009 | { |
| 2011 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 2010 | if (!SYMBOLP (hare) || NILP (hare)) |
| 2012 | break; | 2011 | break; |
| 2013 | hare = XSYMBOL (hare)->function; | 2012 | hare = XSYMBOL (hare)->function; |
| 2014 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 2013 | if (!SYMBOLP (hare) || NILP (hare)) |
| 2015 | break; | 2014 | break; |
| 2016 | hare = XSYMBOL (hare)->function; | 2015 | hare = XSYMBOL (hare)->function; |
| 2017 | 2016 | ||
| @@ -2038,10 +2037,10 @@ function chain of symbols. */) | |||
| 2038 | 2037 | ||
| 2039 | /* Optimize for no indirection. */ | 2038 | /* Optimize for no indirection. */ |
| 2040 | result = object; | 2039 | result = object; |
| 2041 | if (SYMBOLP (result) && !EQ (result, Qunbound) | 2040 | if (SYMBOLP (result) && !NILP (result) |
| 2042 | && (result = XSYMBOL (result)->function, SYMBOLP (result))) | 2041 | && (result = XSYMBOL (result)->function, SYMBOLP (result))) |
| 2043 | result = indirect_function (result); | 2042 | result = indirect_function (result); |
| 2044 | if (!EQ (result, Qunbound)) | 2043 | if (!NILP (result)) |
| 2045 | return result; | 2044 | return result; |
| 2046 | 2045 | ||
| 2047 | if (NILP (noerror)) | 2046 | if (NILP (noerror)) |