comparison src/eval.c @ 4502:8748a3f7ceb4

Handle varalias chains, custom variables in #'user-variable-p. src/ChangeLog addition: 2008-08-23 Aidan Kehoe <kehoea@parhasard.net> * eval.c (Fuser_variable_p): Moved to symbols.c * symbols.c (Fcustom_variable_p): Moved here from custom.el. (user_variable_alias_check_fun): Mapper function used in `user-variable-p'. (Fuser_variable_p): Moved here from eval.c, to allow it to examine the variable alias chain. Expanded to check each entry in the variable alias chain for signs of being a user variable; documentation updated, noting the differences between GNU's behaviour and ours (ours is a little more sensible) (map_varalias_chain): New. Given a C function, call it at least once for each symbol in a symbol's varalias chain, signalling an error if there's a cycle, and returning immediately if the function returns something other than Qzero. (Fdefvaralias): Correct the use of the word "alias" in the docstring and in the argument name. Motivate this in a comment. Add support for a DOCSTRING argument, something GNU has too, and document this * gc.c (vars_of_gc): Start the docstring of `garbage-collection-messages' with an asterisk, to indicate that it's a user variable. lisp/ChangeLog addition: 2008-08-23 Aidan Kehoe <kehoea@parhasard.net> * custom.el: Move #'custom-variable-p to C, since it's now called from #'user-variable-p.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 23 Aug 2008 16:38:51 +0200
parents 8f6a825eb3d3
children 69a1eda3da06
comparison
equal deleted inserted replaced
4501:c4fd85dd95bd 4502:8748a3f7ceb4
1354 1354
1355 LOADHIST_ATTACH (sym); 1355 LOADHIST_ATTACH (sym);
1356 return sym; 1356 return sym;
1357 } 1357 }
1358 1358
1359 DEFUN ("user-variable-p", Fuser_variable_p, 1, 1, 0, /* 1359 /* XEmacs: user-variable-p is in symbols.c, since it needs to mess around
1360 Return t if VARIABLE is intended to be set and modified by users. 1360 with the symbol variable aliases. */
1361 \(The alternative is a variable used internally in a Lisp program.)
1362 Determined by whether the first character of the documentation
1363 for the variable is `*'.
1364 */
1365 (variable))
1366 {
1367 Lisp_Object documentation = Fget (variable, Qvariable_documentation, Qnil);
1368
1369 return
1370 ((INTP (documentation) && XINT (documentation) < 0) ||
1371
1372 (STRINGP (documentation) &&
1373 (string_byte (documentation, 0) == '*')) ||
1374
1375 /* If (STRING . INTEGER), a negative integer means a user variable. */
1376 (CONSP (documentation)
1377 && STRINGP (XCAR (documentation))
1378 && INTP (XCDR (documentation))
1379 && XINT (XCDR (documentation)) < 0)) ?
1380 Qt : Qnil;
1381 }
1382 1361
1383 DEFUN ("macroexpand-internal", Fmacroexpand_internal, 1, 2, 0, /* 1362 DEFUN ("macroexpand-internal", Fmacroexpand_internal, 1, 2, 0, /*
1384 Return result of expanding macros at top level of FORM. 1363 Return result of expanding macros at top level of FORM.
1385 If FORM is not a macro call, it is returned unchanged. 1364 If FORM is not a macro call, it is returned unchanged.
1386 Otherwise, the macro is expanded and the expansion is considered 1365 Otherwise, the macro is expanded and the expansion is considered
6580 DEFSUBR (Ffunction); 6559 DEFSUBR (Ffunction);
6581 DEFSUBR (Fdefun); 6560 DEFSUBR (Fdefun);
6582 DEFSUBR (Fdefmacro); 6561 DEFSUBR (Fdefmacro);
6583 DEFSUBR (Fdefvar); 6562 DEFSUBR (Fdefvar);
6584 DEFSUBR (Fdefconst); 6563 DEFSUBR (Fdefconst);
6585 DEFSUBR (Fuser_variable_p);
6586 DEFSUBR (Flet); 6564 DEFSUBR (Flet);
6587 DEFSUBR (FletX); 6565 DEFSUBR (FletX);
6588 DEFSUBR (Fwhile); 6566 DEFSUBR (Fwhile);
6589 DEFSUBR (Fmacroexpand_internal); 6567 DEFSUBR (Fmacroexpand_internal);
6590 DEFSUBR (Fcatch); 6568 DEFSUBR (Fcatch);