diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 88 |
1 files changed, 14 insertions, 74 deletions
diff --git a/src/eval.c b/src/eval.c index 7f3bf6a866f..d266d995c4b 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -124,6 +124,12 @@ Lisp_Object Vsignaling_function; | |||
| 124 | 124 | ||
| 125 | int handling_signal; | 125 | int handling_signal; |
| 126 | 126 | ||
| 127 | /* If non-nil, Lisp code must not be run since some part of Emacs is | ||
| 128 | in an inconsistent state. Currently, x-create-frame uses this to | ||
| 129 | avoid triggering window-configuration-change-hook while the new | ||
| 130 | frame is half-initialized. */ | ||
| 131 | Lisp_Object inhibit_lisp_code; | ||
| 132 | |||
| 127 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); | 133 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); |
| 128 | static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; | 134 | static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; |
| 129 | static int interactive_p (int); | 135 | static int interactive_p (int); |
| @@ -774,8 +780,6 @@ The optional argument DOCSTRING is a documentation string for the | |||
| 774 | variable. | 780 | variable. |
| 775 | 781 | ||
| 776 | To define a user option, use `defcustom' instead of `defvar'. | 782 | To define a user option, use `defcustom' instead of `defvar'. |
| 777 | The function `user-variable-p' also identifies a variable as a user | ||
| 778 | option if its DOCSTRING starts with *, but this behavior is obsolete. | ||
| 779 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 783 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) |
| 780 | (Lisp_Object args) | 784 | (Lisp_Object args) |
| 781 | { | 785 | { |
| @@ -889,71 +893,6 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | |||
| 889 | return sym; | 893 | return sym; |
| 890 | } | 894 | } |
| 891 | 895 | ||
| 892 | /* Error handler used in Fuser_variable_p. */ | ||
| 893 | static Lisp_Object | ||
| 894 | user_variable_p_eh (Lisp_Object ignore) | ||
| 895 | { | ||
| 896 | return Qnil; | ||
| 897 | } | ||
| 898 | |||
| 899 | static Lisp_Object | ||
| 900 | lisp_indirect_variable (Lisp_Object sym) | ||
| 901 | { | ||
| 902 | struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym)); | ||
| 903 | XSETSYMBOL (sym, s); | ||
| 904 | return sym; | ||
| 905 | } | ||
| 906 | |||
| 907 | DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0, | ||
| 908 | doc: /* Return t if VARIABLE is intended to be set and modified by users. | ||
| 909 | \(The alternative is a variable used internally in a Lisp program.) | ||
| 910 | |||
| 911 | This function returns t if (i) the first character of its | ||
| 912 | documentation is `*', or (ii) it is customizable (its property list | ||
| 913 | contains a non-nil value of `standard-value' or `custom-autoload'), or | ||
| 914 | \(iii) it is an alias for a user variable. | ||
| 915 | |||
| 916 | But condition (i) is considered obsolete, so for most purposes this is | ||
| 917 | equivalent to `custom-variable-p'. */) | ||
| 918 | (Lisp_Object variable) | ||
| 919 | { | ||
| 920 | Lisp_Object documentation; | ||
| 921 | |||
| 922 | if (!SYMBOLP (variable)) | ||
| 923 | return Qnil; | ||
| 924 | |||
| 925 | /* If indirect and there's an alias loop, don't check anything else. */ | ||
| 926 | if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS | ||
| 927 | && NILP (internal_condition_case_1 (lisp_indirect_variable, variable, | ||
| 928 | Qt, user_variable_p_eh))) | ||
| 929 | return Qnil; | ||
| 930 | |||
| 931 | while (1) | ||
| 932 | { | ||
| 933 | documentation = Fget (variable, Qvariable_documentation); | ||
| 934 | if (INTEGERP (documentation) && XINT (documentation) < 0) | ||
| 935 | return Qt; | ||
| 936 | if (STRINGP (documentation) | ||
| 937 | && ((unsigned char) SREF (documentation, 0) == '*')) | ||
| 938 | return Qt; | ||
| 939 | /* If it is (STRING . INTEGER), a negative integer means a user variable. */ | ||
| 940 | if (CONSP (documentation) | ||
| 941 | && STRINGP (XCAR (documentation)) | ||
| 942 | && INTEGERP (XCDR (documentation)) | ||
| 943 | && XINT (XCDR (documentation)) < 0) | ||
| 944 | return Qt; | ||
| 945 | /* Customizable? See `custom-variable-p'. */ | ||
| 946 | if ((!NILP (Fget (variable, intern ("standard-value")))) | ||
| 947 | || (!NILP (Fget (variable, intern ("custom-autoload"))))) | ||
| 948 | return Qt; | ||
| 949 | |||
| 950 | if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS)) | ||
| 951 | return Qnil; | ||
| 952 | |||
| 953 | /* An indirect variable? Let's follow the chain. */ | ||
| 954 | XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable))); | ||
| 955 | } | ||
| 956 | } | ||
| 957 | 896 | ||
| 958 | DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, | 897 | DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, |
| 959 | doc: /* Bind variables according to VARLIST then eval BODY. | 898 | doc: /* Bind variables according to VARLIST then eval BODY. |
| @@ -3592,7 +3531,7 @@ void | |||
| 3592 | syms_of_eval (void) | 3531 | syms_of_eval (void) |
| 3593 | { | 3532 | { |
| 3594 | DEFVAR_INT ("max-specpdl-size", max_specpdl_size, | 3533 | DEFVAR_INT ("max-specpdl-size", max_specpdl_size, |
| 3595 | doc: /* *Limit on number of Lisp variable bindings and `unwind-protect's. | 3534 | doc: /* Limit on number of Lisp variable bindings and `unwind-protect's. |
| 3596 | If Lisp code tries to increase the total number past this amount, | 3535 | If Lisp code tries to increase the total number past this amount, |
| 3597 | an error is signaled. | 3536 | an error is signaled. |
| 3598 | You can safely use a value considerably larger than the default value, | 3537 | You can safely use a value considerably larger than the default value, |
| @@ -3600,7 +3539,7 @@ if that proves inconveniently small. However, if you increase it too far, | |||
| 3600 | Emacs could run out of memory trying to make the stack bigger. */); | 3539 | Emacs could run out of memory trying to make the stack bigger. */); |
| 3601 | 3540 | ||
| 3602 | DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth, | 3541 | DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth, |
| 3603 | doc: /* *Limit on depth in `eval', `apply' and `funcall' before error. | 3542 | doc: /* Limit on depth in `eval', `apply' and `funcall' before error. |
| 3604 | 3543 | ||
| 3605 | This limit serves to catch infinite recursions for you before they cause | 3544 | This limit serves to catch infinite recursions for you before they cause |
| 3606 | actual stack overflow in C, which would be fatal for Emacs. | 3545 | actual stack overflow in C, which would be fatal for Emacs. |
| @@ -3644,7 +3583,7 @@ before making `inhibit-quit' nil. */); | |||
| 3644 | DEFSYM (Qdebug, "debug"); | 3583 | DEFSYM (Qdebug, "debug"); |
| 3645 | 3584 | ||
| 3646 | DEFVAR_LISP ("debug-on-error", Vdebug_on_error, | 3585 | DEFVAR_LISP ("debug-on-error", Vdebug_on_error, |
| 3647 | doc: /* *Non-nil means enter debugger if an error is signaled. | 3586 | doc: /* Non-nil means enter debugger if an error is signaled. |
| 3648 | Does not apply to errors handled by `condition-case' or those | 3587 | Does not apply to errors handled by `condition-case' or those |
| 3649 | matched by `debug-ignored-errors'. | 3588 | matched by `debug-ignored-errors'. |
| 3650 | If the value is a list, an error only means to enter the debugger | 3589 | If the value is a list, an error only means to enter the debugger |
| @@ -3656,7 +3595,7 @@ See also the variable `debug-on-quit'. */); | |||
| 3656 | Vdebug_on_error = Qnil; | 3595 | Vdebug_on_error = Qnil; |
| 3657 | 3596 | ||
| 3658 | DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors, | 3597 | DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors, |
| 3659 | doc: /* *List of errors for which the debugger should not be called. | 3598 | doc: /* List of errors for which the debugger should not be called. |
| 3660 | Each element may be a condition-name or a regexp that matches error messages. | 3599 | Each element may be a condition-name or a regexp that matches error messages. |
| 3661 | If any element applies to a given error, that error skips the debugger | 3600 | If any element applies to a given error, that error skips the debugger |
| 3662 | and just returns to top level. | 3601 | and just returns to top level. |
| @@ -3665,7 +3604,7 @@ It does not apply to errors handled by `condition-case'. */); | |||
| 3665 | Vdebug_ignored_errors = Qnil; | 3604 | Vdebug_ignored_errors = Qnil; |
| 3666 | 3605 | ||
| 3667 | DEFVAR_BOOL ("debug-on-quit", debug_on_quit, | 3606 | DEFVAR_BOOL ("debug-on-quit", debug_on_quit, |
| 3668 | doc: /* *Non-nil means enter debugger if quit is signaled (C-g, for example). | 3607 | doc: /* Non-nil means enter debugger if quit is signaled (C-g, for example). |
| 3669 | Does not apply if quit is handled by a `condition-case'. */); | 3608 | Does not apply if quit is handled by a `condition-case'. */); |
| 3670 | debug_on_quit = 0; | 3609 | debug_on_quit = 0; |
| 3671 | 3610 | ||
| @@ -3694,7 +3633,7 @@ The Edebug package uses this to regain control. */); | |||
| 3694 | Vsignal_hook_function = Qnil; | 3633 | Vsignal_hook_function = Qnil; |
| 3695 | 3634 | ||
| 3696 | DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal, | 3635 | DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal, |
| 3697 | doc: /* *Non-nil means call the debugger regardless of condition handlers. | 3636 | doc: /* Non-nil means call the debugger regardless of condition handlers. |
| 3698 | Note that `debug-on-error', `debug-on-quit' and friends | 3637 | Note that `debug-on-error', `debug-on-quit' and friends |
| 3699 | still determine whether to handle the particular condition. */); | 3638 | still determine whether to handle the particular condition. */); |
| 3700 | Vdebug_on_signal = Qnil; | 3639 | Vdebug_on_signal = Qnil; |
| @@ -3734,6 +3673,8 @@ alist of active lexical bindings. */); | |||
| 3734 | staticpro (&Vsignaling_function); | 3673 | staticpro (&Vsignaling_function); |
| 3735 | Vsignaling_function = Qnil; | 3674 | Vsignaling_function = Qnil; |
| 3736 | 3675 | ||
| 3676 | inhibit_lisp_code = Qnil; | ||
| 3677 | |||
| 3737 | defsubr (&Sor); | 3678 | defsubr (&Sor); |
| 3738 | defsubr (&Sand); | 3679 | defsubr (&Sand); |
| 3739 | defsubr (&Sif); | 3680 | defsubr (&Sif); |
| @@ -3749,7 +3690,6 @@ alist of active lexical bindings. */); | |||
| 3749 | defsubr (&Sdefvar); | 3690 | defsubr (&Sdefvar); |
| 3750 | defsubr (&Sdefvaralias); | 3691 | defsubr (&Sdefvaralias); |
| 3751 | defsubr (&Sdefconst); | 3692 | defsubr (&Sdefconst); |
| 3752 | defsubr (&Suser_variable_p); | ||
| 3753 | defsubr (&Slet); | 3693 | defsubr (&Slet); |
| 3754 | defsubr (&SletX); | 3694 | defsubr (&SletX); |
| 3755 | defsubr (&Swhile); | 3695 | defsubr (&Swhile); |