diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 80 |
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 | |||
| 808 | variable. | 808 | variable. |
| 809 | 809 | ||
| 810 | To define a user option, use `defcustom' instead of `defvar'. | 810 | To define a user option, use `defcustom' instead of `defvar'. |
| 811 | The function `user-variable-p' also identifies a variable as a user | ||
| 812 | option if its DOCSTRING starts with *, but this behavior is obsolete. | ||
| 813 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 811 | usage: (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. */ | ||
| 927 | static Lisp_Object | ||
| 928 | user_variable_p_eh (Lisp_Object ignore) | ||
| 929 | { | ||
| 930 | return Qnil; | ||
| 931 | } | ||
| 932 | |||
| 933 | static Lisp_Object | ||
| 934 | lisp_indirect_variable (Lisp_Object sym) | ||
| 935 | { | ||
| 936 | struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym)); | ||
| 937 | XSETSYMBOL (sym, s); | ||
| 938 | return sym; | ||
| 939 | } | ||
| 940 | |||
| 941 | DEFUN ("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 | |||
| 945 | This function returns t if (i) the first character of its | ||
| 946 | documentation is `*', or (ii) it is customizable (its property list | ||
| 947 | contains a non-nil value of `standard-value' or `custom-autoload'), or | ||
| 948 | \(iii) it is an alias for a user variable. | ||
| 949 | |||
| 950 | But condition (i) is considered obsolete, so for most purposes this is | ||
| 951 | equivalent 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 | ||
| 992 | DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, | 925 | DEFUN ("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 | |||
| 3630 | syms_of_eval (void) | 3563 | syms_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. |
| 3634 | If Lisp code tries to increase the total number past this amount, | 3567 | If Lisp code tries to increase the total number past this amount, |
| 3635 | an error is signaled. | 3568 | an error is signaled. |
| 3636 | You can safely use a value considerably larger than the default value, | 3569 | You 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, | |||
| 3638 | Emacs could run out of memory trying to make the stack bigger. */); | 3571 | Emacs 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 | ||
| 3643 | This limit serves to catch infinite recursions for you before they cause | 3576 | This limit serves to catch infinite recursions for you before they cause |
| 3644 | actual stack overflow in C, which would be fatal for Emacs. | 3577 | actual 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. |
| 3686 | Does not apply to errors handled by `condition-case' or those | 3619 | Does not apply to errors handled by `condition-case' or those |
| 3687 | matched by `debug-ignored-errors'. | 3620 | matched by `debug-ignored-errors'. |
| 3688 | If the value is a list, an error only means to enter the debugger | 3621 | If 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. |
| 3698 | Each element may be a condition-name or a regexp that matches error messages. | 3631 | Each element may be a condition-name or a regexp that matches error messages. |
| 3699 | If any element applies to a given error, that error skips the debugger | 3632 | If any element applies to a given error, that error skips the debugger |
| 3700 | and just returns to top level. | 3633 | and 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). |
| 3707 | Does not apply if quit is handled by a `condition-case'. */); | 3640 | Does 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. |
| 3736 | Note that `debug-on-error', `debug-on-quit' and friends | 3669 | Note that `debug-on-error', `debug-on-quit' and friends |
| 3737 | still determine whether to handle the particular condition. */); | 3670 | still 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); |