comparison src/data.c @ 46279:5f4ed17e4396

(Fdefalias): Add an optional `docstring' argument. (set_internal, Fsetq_default): Use XCAR/XCDR.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 09 Jul 2002 23:12:30 +0000
parents bc5d63652a0a
children 40db0673e6f0
comparison
equal deleted inserted replaced
46278:ae7e64529fa0 46279:5f4ed17e4396
702 definition = XSYMBOL (symbol)->function; 702 definition = XSYMBOL (symbol)->function;
703 } 703 }
704 return definition; 704 return definition;
705 } 705 }
706 706
707 DEFUN ("defalias", Fdefalias, Sdefalias, 2, 2, 0, 707 extern Lisp_Object Qfunction_documentation;
708
709 DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
708 doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION. 710 doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION.
709 Associates the function with the current load file, if any. */) 711 Associates the function with the current load file, if any. */)
710 (symbol, definition) 712 (symbol, definition, docstring)
711 register Lisp_Object symbol, definition; 713 register Lisp_Object symbol, definition, docstring;
712 { 714 {
713 definition = Ffset (symbol, definition); 715 definition = Ffset (symbol, definition);
714 LOADHIST_ATTACH (symbol); 716 LOADHIST_ATTACH (symbol);
717 if (!NILP (docstring))
718 Fput (symbol, Qfunction_documentation, docstring);
715 return definition; 719 return definition;
716 } 720 }
717 721
718 DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0, 722 DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
719 doc: /* Set SYMBOL's property list to NEWVAL, and return NEWVAL. */) 723 doc: /* Set SYMBOL's property list to NEWVAL, and return NEWVAL. */)
1207 create a new buffer-local binding for the variable. 1211 create a new buffer-local binding for the variable.
1208 That means, give this buffer a new assoc for a local value 1212 That means, give this buffer a new assoc for a local value
1209 and load that binding. */ 1213 and load that binding. */
1210 else 1214 else
1211 { 1215 {
1212 tem1 = Fcons (symbol, Fcdr (current_alist_element)); 1216 tem1 = Fcons (symbol, XCDR (current_alist_element));
1213 buf->local_var_alist 1217 buf->local_var_alist
1214 = Fcons (tem1, buf->local_var_alist); 1218 = Fcons (tem1, buf->local_var_alist);
1215 } 1219 }
1216 } 1220 }
1217 1221
1409 GCPRO1 (args); 1413 GCPRO1 (args);
1410 1414
1411 do 1415 do
1412 { 1416 {
1413 val = Feval (Fcar (Fcdr (args_left))); 1417 val = Feval (Fcar (Fcdr (args_left)));
1414 symbol = Fcar (args_left); 1418 symbol = XCAR (args_left);
1415 Fset_default (symbol, val); 1419 Fset_default (symbol, val);
1416 args_left = Fcdr (Fcdr (args_left)); 1420 args_left = Fcdr (XCDR (args_left));
1417 } 1421 }
1418 while (!NILP (args_left)); 1422 while (!NILP (args_left));
1419 1423
1420 UNGCPRO; 1424 UNGCPRO;
1421 return val; 1425 return val;