aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c80
1 files changed, 6 insertions, 74 deletions
diff --git a/src/eval.c b/src/eval.c
index 4a3f5083b3b..cb0518f34ec 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -808,8 +808,6 @@ The optional argument DOCSTRING is a documentation string for the
808variable. 808variable.
809 809
810To define a user option, use `defcustom' instead of `defvar'. 810To define a user option, use `defcustom' instead of `defvar'.
811The function `user-variable-p' also identifies a variable as a user
812option if its DOCSTRING starts with *, but this behavior is obsolete.
813usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) 811usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
814 (Lisp_Object args) 812 (Lisp_Object args)
815{ 813{
@@ -923,71 +921,6 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
923 return sym; 921 return sym;
924} 922}
925 923
926/* Error handler used in Fuser_variable_p. */
927static Lisp_Object
928user_variable_p_eh (Lisp_Object ignore)
929{
930 return Qnil;
931}
932
933static Lisp_Object
934lisp_indirect_variable (Lisp_Object sym)
935{
936 struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
937 XSETSYMBOL (sym, s);
938 return sym;
939}
940
941DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
942 doc: /* Return t if VARIABLE is intended to be set and modified by users.
943\(The alternative is a variable used internally in a Lisp program.)
944
945This function returns t if (i) the first character of its
946documentation is `*', or (ii) it is customizable (its property list
947contains a non-nil value of `standard-value' or `custom-autoload'), or
948\(iii) it is an alias for a user variable.
949
950But condition (i) is considered obsolete, so for most purposes this is
951equivalent to `custom-variable-p'. */)
952 (Lisp_Object variable)
953{
954 Lisp_Object documentation;
955
956 if (!SYMBOLP (variable))
957 return Qnil;
958
959 /* If indirect and there's an alias loop, don't check anything else. */
960 if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
961 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
962 Qt, user_variable_p_eh)))
963 return Qnil;
964
965 while (1)
966 {
967 documentation = Fget (variable, Qvariable_documentation);
968 if (INTEGERP (documentation) && XINT (documentation) < 0)
969 return Qt;
970 if (STRINGP (documentation)
971 && ((unsigned char) SREF (documentation, 0) == '*'))
972 return Qt;
973 /* If it is (STRING . INTEGER), a negative integer means a user variable. */
974 if (CONSP (documentation)
975 && STRINGP (XCAR (documentation))
976 && INTEGERP (XCDR (documentation))
977 && XINT (XCDR (documentation)) < 0)
978 return Qt;
979 /* Customizable? See `custom-variable-p'. */
980 if ((!NILP (Fget (variable, intern ("standard-value"))))
981 || (!NILP (Fget (variable, intern ("custom-autoload")))))
982 return Qt;
983
984 if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
985 return Qnil;
986
987 /* An indirect variable? Let's follow the chain. */
988 XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
989 }
990}
991 924
992DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, 925DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
993 doc: /* Bind variables according to VARLIST then eval BODY. 926 doc: /* Bind variables according to VARLIST then eval BODY.
@@ -3630,7 +3563,7 @@ void
3630syms_of_eval (void) 3563syms_of_eval (void)
3631{ 3564{
3632 DEFVAR_INT ("max-specpdl-size", max_specpdl_size, 3565 DEFVAR_INT ("max-specpdl-size", max_specpdl_size,
3633 doc: /* *Limit on number of Lisp variable bindings and `unwind-protect's. 3566 doc: /* Limit on number of Lisp variable bindings and `unwind-protect's.
3634If Lisp code tries to increase the total number past this amount, 3567If Lisp code tries to increase the total number past this amount,
3635an error is signaled. 3568an error is signaled.
3636You can safely use a value considerably larger than the default value, 3569You can safely use a value considerably larger than the default value,
@@ -3638,7 +3571,7 @@ if that proves inconveniently small. However, if you increase it too far,
3638Emacs could run out of memory trying to make the stack bigger. */); 3571Emacs could run out of memory trying to make the stack bigger. */);
3639 3572
3640 DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth, 3573 DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth,
3641 doc: /* *Limit on depth in `eval', `apply' and `funcall' before error. 3574 doc: /* Limit on depth in `eval', `apply' and `funcall' before error.
3642 3575
3643This limit serves to catch infinite recursions for you before they cause 3576This limit serves to catch infinite recursions for you before they cause
3644actual stack overflow in C, which would be fatal for Emacs. 3577actual stack overflow in C, which would be fatal for Emacs.
@@ -3682,7 +3615,7 @@ before making `inhibit-quit' nil. */);
3682 DEFSYM (Qdebug, "debug"); 3615 DEFSYM (Qdebug, "debug");
3683 3616
3684 DEFVAR_LISP ("debug-on-error", Vdebug_on_error, 3617 DEFVAR_LISP ("debug-on-error", Vdebug_on_error,
3685 doc: /* *Non-nil means enter debugger if an error is signaled. 3618 doc: /* Non-nil means enter debugger if an error is signaled.
3686Does not apply to errors handled by `condition-case' or those 3619Does not apply to errors handled by `condition-case' or those
3687matched by `debug-ignored-errors'. 3620matched by `debug-ignored-errors'.
3688If the value is a list, an error only means to enter the debugger 3621If the value is a list, an error only means to enter the debugger
@@ -3694,7 +3627,7 @@ See also the variable `debug-on-quit'. */);
3694 Vdebug_on_error = Qnil; 3627 Vdebug_on_error = Qnil;
3695 3628
3696 DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors, 3629 DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors,
3697 doc: /* *List of errors for which the debugger should not be called. 3630 doc: /* List of errors for which the debugger should not be called.
3698Each element may be a condition-name or a regexp that matches error messages. 3631Each element may be a condition-name or a regexp that matches error messages.
3699If any element applies to a given error, that error skips the debugger 3632If any element applies to a given error, that error skips the debugger
3700and just returns to top level. 3633and just returns to top level.
@@ -3703,7 +3636,7 @@ It does not apply to errors handled by `condition-case'. */);
3703 Vdebug_ignored_errors = Qnil; 3636 Vdebug_ignored_errors = Qnil;
3704 3637
3705 DEFVAR_BOOL ("debug-on-quit", debug_on_quit, 3638 DEFVAR_BOOL ("debug-on-quit", debug_on_quit,
3706 doc: /* *Non-nil means enter debugger if quit is signaled (C-g, for example). 3639 doc: /* Non-nil means enter debugger if quit is signaled (C-g, for example).
3707Does not apply if quit is handled by a `condition-case'. */); 3640Does not apply if quit is handled by a `condition-case'. */);
3708 debug_on_quit = 0; 3641 debug_on_quit = 0;
3709 3642
@@ -3732,7 +3665,7 @@ The Edebug package uses this to regain control. */);
3732 Vsignal_hook_function = Qnil; 3665 Vsignal_hook_function = Qnil;
3733 3666
3734 DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal, 3667 DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal,
3735 doc: /* *Non-nil means call the debugger regardless of condition handlers. 3668 doc: /* Non-nil means call the debugger regardless of condition handlers.
3736Note that `debug-on-error', `debug-on-quit' and friends 3669Note that `debug-on-error', `debug-on-quit' and friends
3737still determine whether to handle the particular condition. */); 3670still determine whether to handle the particular condition. */);
3738 Vdebug_on_signal = Qnil; 3671 Vdebug_on_signal = Qnil;
@@ -3789,7 +3722,6 @@ alist of active lexical bindings. */);
3789 defsubr (&Sdefvar); 3722 defsubr (&Sdefvar);
3790 defsubr (&Sdefvaralias); 3723 defsubr (&Sdefvaralias);
3791 defsubr (&Sdefconst); 3724 defsubr (&Sdefconst);
3792 defsubr (&Suser_variable_p);
3793 defsubr (&Slet); 3725 defsubr (&Slet);
3794 defsubr (&SletX); 3726 defsubr (&SletX);
3795 defsubr (&Swhile); 3727 defsubr (&Swhile);