aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert2012-04-09 15:54:59 -0700
committerPaul Eggert2012-04-09 15:54:59 -0700
commit45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193 (patch)
tree5bc87a8b5a3c754b8eb44a612cc6c03561d6b968 /src/eval.c
parent9d6b4d53469a9ffd67bd770fabc6fe254e35c21d (diff)
parent05920a43fc18e696b464387e781e7cfdcea5b5af (diff)
downloademacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.tar.gz
emacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.zip
Merge from trunk.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c88
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
125int handling_signal; 125int 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. */
131Lisp_Object inhibit_lisp_code;
132
127static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); 133static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
128static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; 134static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
129static int interactive_p (int); 135static int interactive_p (int);
@@ -774,8 +780,6 @@ The optional argument DOCSTRING is a documentation string for the
774variable. 780variable.
775 781
776To define a user option, use `defcustom' instead of `defvar'. 782To define a user option, use `defcustom' instead of `defvar'.
777The function `user-variable-p' also identifies a variable as a user
778option if its DOCSTRING starts with *, but this behavior is obsolete.
779usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) 783usage: (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. */
893static Lisp_Object
894user_variable_p_eh (Lisp_Object ignore)
895{
896 return Qnil;
897}
898
899static Lisp_Object
900lisp_indirect_variable (Lisp_Object sym)
901{
902 struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
903 XSETSYMBOL (sym, s);
904 return sym;
905}
906
907DEFUN ("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
911This function returns t if (i) the first character of its
912documentation is `*', or (ii) it is customizable (its property list
913contains a non-nil value of `standard-value' or `custom-autoload'), or
914\(iii) it is an alias for a user variable.
915
916But condition (i) is considered obsolete, so for most purposes this is
917equivalent 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
958DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, 897DEFUN ("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
3592syms_of_eval (void) 3531syms_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.
3596If Lisp code tries to increase the total number past this amount, 3535If Lisp code tries to increase the total number past this amount,
3597an error is signaled. 3536an error is signaled.
3598You can safely use a value considerably larger than the default value, 3537You 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,
3600Emacs could run out of memory trying to make the stack bigger. */); 3539Emacs 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
3605This limit serves to catch infinite recursions for you before they cause 3544This limit serves to catch infinite recursions for you before they cause
3606actual stack overflow in C, which would be fatal for Emacs. 3545actual 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.
3648Does not apply to errors handled by `condition-case' or those 3587Does not apply to errors handled by `condition-case' or those
3649matched by `debug-ignored-errors'. 3588matched by `debug-ignored-errors'.
3650If the value is a list, an error only means to enter the debugger 3589If 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.
3660Each element may be a condition-name or a regexp that matches error messages. 3599Each element may be a condition-name or a regexp that matches error messages.
3661If any element applies to a given error, that error skips the debugger 3600If any element applies to a given error, that error skips the debugger
3662and just returns to top level. 3601and 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).
3669Does not apply if quit is handled by a `condition-case'. */); 3608Does 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.
3698Note that `debug-on-error', `debug-on-quit' and friends 3637Note that `debug-on-error', `debug-on-quit' and friends
3699still determine whether to handle the particular condition. */); 3638still 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);