[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110966: Conflate Qnil and Qunbound f
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110966: Conflate Qnil and Qunbound for `symbol-function'. |
Date: |
Tue, 20 Nov 2012 15:06:17 -0500 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110966
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-11-20 15:06:17 -0500
message:
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.
modified:
etc/NEWS
src/ChangeLog
src/alloc.c
src/data.c
src/eval.c
src/lisp.h
src/lread.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-11-20 19:30:37 +0000
+++ b/etc/NEWS 2012-11-20 20:06:17 +0000
@@ -52,6 +52,10 @@
* Incompatible Lisp Changes in Emacs 24.4
+** nil and "unbound" are indistinguishable in symbol-function.
+`symbol-function' never signals `void-function' any more.
+`fboundp' returns non-nil if the symbol was `fset' to nil.
+
** `defadvice' does not honor the `freeze' flag and cannot advise
special-forms any more.
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-11-20 11:41:57 +0000
+++ b/src/ChangeLog 2012-11-20 20:06:17 +0000
@@ -1,3 +1,16 @@
+2012-11-20 Stefan Monnier <address@hidden>
+
+ Conflate Qnil and Qunbound for `symbol-function'.
+ * alloc.c (Fmake_symbol): Initialize `function' to Qnil.
+ * lread.c (init_obarray): Set `function' fields to Qnil.
+ * eval.c (Fcommandp): Ignore Qunbound.
+ (Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand):
+ * 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.
+
2012-11-20 Paul Eggert <address@hidden>
* eval.c (interactive_p): Remove no-longer-used decl.
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2012-11-12 01:09:34 +0000
+++ b/src/alloc.c 2012-11-20 20:06:17 +0000
@@ -3212,7 +3212,7 @@
DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
doc: /* Return a newly allocated uninterned symbol whose name is NAME.
-Its value and function definition are void, and its property list is nil. */)
+Its value is void, and its function definition and property list are nil. */)
(Lisp_Object name)
{
register Lisp_Object val;
@@ -3249,7 +3249,7 @@
set_symbol_plist (val, Qnil);
p->redirect = SYMBOL_PLAINVAL;
SET_SYMBOL_VAL (p, Qunbound);
- set_symbol_function (val, Qunbound);
+ set_symbol_function (val, Qnil);
set_symbol_next (val, NULL);
p->gcmarkbit = 0;
p->interned = SYMBOL_UNINTERNED;
=== modified file 'src/data.c'
--- a/src/data.c 2012-11-12 02:08:06 +0000
+++ b/src/data.c 2012-11-20 20:06:17 +0000
@@ -543,12 +543,13 @@
return (EQ (valcontents, Qunbound) ? Qnil : Qt);
}
+/* FIXME: Make it an alias for function-symbol! */
DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
doc: /* Return t if SYMBOL's function definition is not void. */)
(register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt;
+ return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt;
}
DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -564,14 +565,14 @@
}
DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0,
- doc: /* Make SYMBOL's function definition be void.
+ doc: /* Make SYMBOL's function definition be nil.
Return SYMBOL. */)
(register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
if (NILP (symbol) || EQ (symbol, Qt))
xsignal1 (Qsetting_constant, symbol);
- set_symbol_function (symbol, Qunbound);
+ set_symbol_function (symbol, Qnil);
return symbol;
}
@@ -580,9 +581,7 @@
(register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- if (!EQ (XSYMBOL (symbol)->function, Qunbound))
return XSYMBOL (symbol)->function;
- xsignal1 (Qvoid_function, symbol);
}
DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
@@ -613,7 +612,7 @@
function = XSYMBOL (symbol)->function;
- if (!NILP (Vautoload_queue) && !EQ (function, Qunbound))
+ if (!NILP (Vautoload_queue) && !NILP (function))
Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
if (AUTOLOADP (function))
@@ -714,7 +713,7 @@
{
Lisp_Object fun = indirect_function (cmd); /* Check cycles. */
- if (NILP (fun) || EQ (fun, Qunbound))
+ if (NILP (fun))
return Qnil;
/* Use an `interactive-form' property if present, analogous to the
@@ -2008,10 +2007,10 @@
for (;;)
{
- if (!SYMBOLP (hare) || EQ (hare, Qunbound))
+ if (!SYMBOLP (hare) || NILP (hare))
break;
hare = XSYMBOL (hare)->function;
- if (!SYMBOLP (hare) || EQ (hare, Qunbound))
+ if (!SYMBOLP (hare) || NILP (hare))
break;
hare = XSYMBOL (hare)->function;
@@ -2038,10 +2037,10 @@
/* Optimize for no indirection. */
result = object;
- if (SYMBOLP (result) && !EQ (result, Qunbound)
+ if (SYMBOLP (result) && !NILP (result)
&& (result = XSYMBOL (result)->function, SYMBOLP (result)))
result = indirect_function (result);
- if (!EQ (result, Qunbound))
+ if (!NILP (result))
return result;
if (NILP (noerror))
=== modified file 'src/eval.c'
--- a/src/eval.c 2012-11-20 08:32:19 +0000
+++ b/src/eval.c 2012-11-20 20:06:17 +0000
@@ -875,7 +875,7 @@
if (NILP (tem))
{
def = XSYMBOL (sym)->function;
- if (!EQ (def, Qunbound))
+ if (!NILP (def))
continue;
}
break;
@@ -890,7 +890,7 @@
GCPRO1 (form);
def = Fautoload_do_load (def, sym, Qmacro);
UNGCPRO;
- if (EQ (def, Qunbound) || !CONSP (def))
+ if (!CONSP (def))
/* Not defined or definition not suitable. */
break;
if (!EQ (XCAR (def), Qmacro))
@@ -1715,12 +1715,12 @@
fun = function;
- fun = indirect_function (fun); /* Check cycles. */
- if (NILP (fun) || EQ (fun, Qunbound))
+ fun = indirect_function (fun); /* Check cycles. */
+ if (NILP (fun))
return Qnil;
/* Check an `interactive-form' property if present, analogous to the
- function-documentation property. */
+ function-documentation property. */
fun = function;
while (SYMBOLP (fun))
{
@@ -1780,7 +1780,7 @@
CHECK_STRING (file);
/* If function is defined and not as an autoload, don't override. */
- if (!EQ (XSYMBOL (function)->function, Qunbound)
+ if (!NILP (XSYMBOL (function)->function)
&& !AUTOLOADP (XSYMBOL (function)->function))
return Qnil;
@@ -1959,7 +1959,7 @@
/* Optimize for no indirection. */
fun = original_fun;
- if (SYMBOLP (fun) && !EQ (fun, Qunbound)
+ if (SYMBOLP (fun) && !NILP (fun)
&& (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
fun = indirect_function (fun);
@@ -2081,7 +2081,7 @@
val = apply_lambda (fun, original_args);
else
{
- if (EQ (fun, Qunbound))
+ if (NILP (fun))
xsignal1 (Qvoid_function, original_fun);
if (!CONSP (fun))
xsignal1 (Qinvalid_function, original_fun);
@@ -2155,10 +2155,10 @@
numargs += nargs - 2;
/* Optimize for no indirection. */
- if (SYMBOLP (fun) && !EQ (fun, Qunbound)
+ if (SYMBOLP (fun) && !NILP (fun)
&& (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
fun = indirect_function (fun);
- if (EQ (fun, Qunbound))
+ if (NILP (fun))
{
/* Let funcall get the error. */
fun = args[0];
@@ -2632,7 +2632,7 @@
/* Optimize for no indirection. */
fun = original_fun;
- if (SYMBOLP (fun) && !EQ (fun, Qunbound)
+ if (SYMBOLP (fun) && !NILP (fun)
&& (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
fun = indirect_function (fun);
@@ -2720,7 +2720,7 @@
val = funcall_lambda (fun, numargs, args + 1);
else
{
- if (EQ (fun, Qunbound))
+ if (NILP (fun))
xsignal1 (Qvoid_function, original_fun);
if (!CONSP (fun))
xsignal1 (Qinvalid_function, original_fun);
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-11-14 04:55:41 +0000
+++ b/src/lisp.h 2012-11-20 20:06:17 +0000
@@ -1104,7 +1104,7 @@
union Lisp_Fwd *fwd;
} val;
- /* Function value of the symbol or Qunbound if not fboundp. */
+ /* Function value of the symbol or Qnil if not fboundp. */
Lisp_Object function;
/* The symbol's property list. */
=== modified file 'src/lread.c'
--- a/src/lread.c 2012-11-14 04:55:41 +0000
+++ b/src/lread.c 2012-11-20 20:06:17 +0000
@@ -3957,12 +3957,13 @@
/* Fmake_symbol inits fields of new symbols with Qunbound and Qnil,
so those two need to be fixed manually. */
SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound);
- set_symbol_function (Qunbound, Qunbound);
+ set_symbol_function (Qunbound, Qnil);
set_symbol_plist (Qunbound, Qnil);
SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
XSYMBOL (Qnil)->constant = 1;
XSYMBOL (Qnil)->declared_special = 1;
set_symbol_plist (Qnil, Qnil);
+ set_symbol_function (Qnil, Qnil);
Qt = intern_c_string ("t");
SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110966: Conflate Qnil and Qunbound for `symbol-function'.,
Stefan Monnier <=