aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c77
1 files changed, 35 insertions, 42 deletions
diff --git a/src/eval.c b/src/eval.c
index d984331ec41..4d200fbc2bd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -119,13 +119,13 @@ static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
119 119
120/* Functions to set Lisp_Object slots of struct specbinding. */ 120/* Functions to set Lisp_Object slots of struct specbinding. */
121 121
122static inline void 122static void
123set_specpdl_symbol (Lisp_Object symbol) 123set_specpdl_symbol (Lisp_Object symbol)
124{ 124{
125 specpdl_ptr->symbol = symbol; 125 specpdl_ptr->symbol = symbol;
126} 126}
127 127
128static inline void 128static void
129set_specpdl_old_value (Lisp_Object oldval) 129set_specpdl_old_value (Lisp_Object oldval)
130{ 130{
131 specpdl_ptr->old_value = oldval; 131 specpdl_ptr->old_value = oldval;
@@ -552,7 +552,7 @@ interactive_p (void)
552 552
553 /* If this isn't a byte-compiled function, there may be a frame at 553 /* If this isn't a byte-compiled function, there may be a frame at
554 the top for Finteractive_p. If so, skip it. */ 554 the top for Finteractive_p. If so, skip it. */
555 fun = Findirect_function (*btp->function, Qnil); 555 fun = Findirect_function (btp->function, Qnil);
556 if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p 556 if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p
557 || XSUBR (fun) == &Scalled_interactively_p)) 557 || XSUBR (fun) == &Scalled_interactively_p))
558 btp = btp->next; 558 btp = btp->next;
@@ -565,7 +565,7 @@ interactive_p (void)
565 If this isn't a byte-compiled function, then we may now be 565 If this isn't a byte-compiled function, then we may now be
566 looking at several frames for special forms. Skip past them. */ 566 looking at several frames for special forms. Skip past them. */
567 while (btp 567 while (btp
568 && (EQ (*btp->function, Qbytecode) 568 && (EQ (btp->function, Qbytecode)
569 || btp->nargs == UNEVALLED)) 569 || btp->nargs == UNEVALLED))
570 btp = btp->next; 570 btp = btp->next;
571 571
@@ -573,13 +573,13 @@ interactive_p (void)
573 a special form, ignoring frames for Finteractive_p and/or 573 a special form, ignoring frames for Finteractive_p and/or
574 Fbytecode at the top. If this frame is for a built-in function 574 Fbytecode at the top. If this frame is for a built-in function
575 (such as load or eval-region) return false. */ 575 (such as load or eval-region) return false. */
576 fun = Findirect_function (*btp->function, Qnil); 576 fun = Findirect_function (btp->function, Qnil);
577 if (SUBRP (fun)) 577 if (SUBRP (fun))
578 return 0; 578 return 0;
579 579
580 /* `btp' points to the frame of a Lisp function that called interactive-p. 580 /* `btp' points to the frame of a Lisp function that called interactive-p.
581 Return t if that function was called interactively. */ 581 Return t if that function was called interactively. */
582 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) 582 if (btp && btp->next && EQ (btp->next->function, Qcall_interactively))
583 return 1; 583 return 1;
584 return 0; 584 return 0;
585} 585}
@@ -1496,10 +1496,10 @@ See also the function `condition-case'. */)
1496 if (backtrace_list && !NILP (error_symbol)) 1496 if (backtrace_list && !NILP (error_symbol))
1497 { 1497 {
1498 bp = backtrace_list->next; 1498 bp = backtrace_list->next;
1499 if (bp && bp->function && EQ (*bp->function, Qerror)) 1499 if (bp && EQ (bp->function, Qerror))
1500 bp = bp->next; 1500 bp = bp->next;
1501 if (bp && bp->function) 1501 if (bp)
1502 Vsignaling_function = *bp->function; 1502 Vsignaling_function = bp->function;
1503 } 1503 }
1504 1504
1505 for (h = handlerlist; h; h = h->next) 1505 for (h = handlerlist; h; h = h->next)
@@ -1510,7 +1510,7 @@ See also the function `condition-case'. */)
1510 } 1510 }
1511 1511
1512 if (/* Don't run the debugger for a memory-full error. 1512 if (/* Don't run the debugger for a memory-full error.
1513 (There is no room in memory to do that!) */ 1513 (There is no room in memory to do that!) */
1514 !NILP (error_symbol) 1514 !NILP (error_symbol)
1515 && (!NILP (Vdebug_on_signal) 1515 && (!NILP (Vdebug_on_signal)
1516 /* If no handler is present now, try to run the debugger. */ 1516 /* If no handler is present now, try to run the debugger. */
@@ -2045,7 +2045,7 @@ eval_sub (Lisp_Object form)
2045 original_args = XCDR (form); 2045 original_args = XCDR (form);
2046 2046
2047 backtrace.next = backtrace_list; 2047 backtrace.next = backtrace_list;
2048 backtrace.function = &original_fun; /* This also protects them from gc. */ 2048 backtrace.function = original_fun; /* This also protects them from gc. */
2049 backtrace.args = &original_args; 2049 backtrace.args = &original_args;
2050 backtrace.nargs = UNEVALLED; 2050 backtrace.nargs = UNEVALLED;
2051 backtrace.debug_on_exit = 0; 2051 backtrace.debug_on_exit = 0;
@@ -2351,14 +2351,10 @@ usage: (run-hooks &rest HOOKS) */)
2351DEFUN ("run-hook-with-args", Frun_hook_with_args, 2351DEFUN ("run-hook-with-args", Frun_hook_with_args,
2352 Srun_hook_with_args, 1, MANY, 0, 2352 Srun_hook_with_args, 1, MANY, 0,
2353 doc: /* Run HOOK with the specified arguments ARGS. 2353 doc: /* Run HOOK with the specified arguments ARGS.
2354HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2354HOOK should be a symbol, a hook variable. The value of HOOK
2355value, that value may be a function or a list of functions to be 2355may be nil, a function, or a list of functions. Call each
2356called to run the hook. If the value is a function, it is called with 2356function in order with arguments ARGS. The final return value
2357the given arguments and its return value is returned. If it is a list 2357is unspecified.
2358of functions, those functions are called, in order,
2359with the given arguments ARGS.
2360It is best not to depend on the value returned by `run-hook-with-args',
2361as that may change.
2362 2358
2363Do not use `make-local-variable' to make a hook variable buffer-local. 2359Do not use `make-local-variable' to make a hook variable buffer-local.
2364Instead, use `add-hook' and specify t for the LOCAL argument. 2360Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2368,18 +2364,18 @@ usage: (run-hook-with-args HOOK &rest ARGS) */)
2368 return run_hook_with_args (nargs, args, funcall_nil); 2364 return run_hook_with_args (nargs, args, funcall_nil);
2369} 2365}
2370 2366
2367/* NB this one still documents a specific non-nil return value.
2368 (As did run-hook-with-args and run-hook-with-args-until-failure
2369 until they were changed in 24.1.) */
2371DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, 2370DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success,
2372 Srun_hook_with_args_until_success, 1, MANY, 0, 2371 Srun_hook_with_args_until_success, 1, MANY, 0,
2373 doc: /* Run HOOK with the specified arguments ARGS. 2372 doc: /* Run HOOK with the specified arguments ARGS.
2374HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2373HOOK should be a symbol, a hook variable. The value of HOOK
2375value, that value may be a function or a list of functions to be 2374may be nil, a function, or a list of functions. Call each
2376called to run the hook. If the value is a function, it is called with 2375function in order with arguments ARGS, stopping at the first
2377the given arguments and its return value is returned. 2376one that returns non-nil, and return that value. Otherwise (if
2378If it is a list of functions, those functions are called, in order, 2377all functions return nil, or if there are no functions to call),
2379with the given arguments ARGS, until one of them 2378return nil.
2380returns a non-nil value. Then we return that value.
2381However, if they all return nil, we return nil.
2382If the value of HOOK is nil, this function returns nil.
2383 2379
2384Do not use `make-local-variable' to make a hook variable buffer-local. 2380Do not use `make-local-variable' to make a hook variable buffer-local.
2385Instead, use `add-hook' and specify t for the LOCAL argument. 2381Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2398,15 +2394,12 @@ funcall_not (ptrdiff_t nargs, Lisp_Object *args)
2398DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, 2394DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure,
2399 Srun_hook_with_args_until_failure, 1, MANY, 0, 2395 Srun_hook_with_args_until_failure, 1, MANY, 0,
2400 doc: /* Run HOOK with the specified arguments ARGS. 2396 doc: /* Run HOOK with the specified arguments ARGS.
2401HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2397HOOK should be a symbol, a hook variable. The value of HOOK
2402value, that value may be a function or a list of functions to be 2398may be nil, a function, or a list of functions. Call each
2403called to run the hook. If the value is a function, it is called with 2399function in order with arguments ARGS, stopping at the first
2404the given arguments. Then we return nil if the function returns nil, 2400one that returns nil, and return nil. Otherwise (if all functions
2405and t if it returns non-nil. 2401return non-nil, or if there are no functions to call), return non-nil
2406If it is a list of functions, those functions are called, in order, 2402\(do not rely on the precise return value in this case).
2407with the given arguments ARGS, until one of them returns nil.
2408Then we return nil. However, if they all return non-nil, we return t.
2409If the value of HOOK is nil, this function returns t.
2410 2403
2411Do not use `make-local-variable' to make a hook variable buffer-local. 2404Do not use `make-local-variable' to make a hook variable buffer-local.
2412Instead, use `add-hook' and specify t for the LOCAL argument. 2405Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2720,7 +2713,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2720 } 2713 }
2721 2714
2722 backtrace.next = backtrace_list; 2715 backtrace.next = backtrace_list;
2723 backtrace.function = &args[0]; 2716 backtrace.function = args[0];
2724 backtrace.args = &args[1]; /* This also GCPROs them. */ 2717 backtrace.args = &args[1]; /* This also GCPROs them. */
2725 backtrace.nargs = nargs - 1; 2718 backtrace.nargs = nargs - 1;
2726 backtrace.debug_on_exit = 0; 2719 backtrace.debug_on_exit = 0;
@@ -3296,12 +3289,12 @@ Output stream used is value of `standard-output'. */)
3296 write_string (backlist->debug_on_exit ? "* " : " ", 2); 3289 write_string (backlist->debug_on_exit ? "* " : " ", 2);
3297 if (backlist->nargs == UNEVALLED) 3290 if (backlist->nargs == UNEVALLED)
3298 { 3291 {
3299 Fprin1 (Fcons (*backlist->function, *backlist->args), Qnil); 3292 Fprin1 (Fcons (backlist->function, *backlist->args), Qnil);
3300 write_string ("\n", -1); 3293 write_string ("\n", -1);
3301 } 3294 }
3302 else 3295 else
3303 { 3296 {
3304 tem = *backlist->function; 3297 tem = backlist->function;
3305 Fprin1 (tem, Qnil); /* This can QUIT. */ 3298 Fprin1 (tem, Qnil); /* This can QUIT. */
3306 write_string ("(", -1); 3299 write_string ("(", -1);
3307 if (backlist->nargs == MANY) 3300 if (backlist->nargs == MANY)
@@ -3359,7 +3352,7 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3359 if (!backlist) 3352 if (!backlist)
3360 return Qnil; 3353 return Qnil;
3361 if (backlist->nargs == UNEVALLED) 3354 if (backlist->nargs == UNEVALLED)
3362 return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); 3355 return Fcons (Qnil, Fcons (backlist->function, *backlist->args));
3363 else 3356 else
3364 { 3357 {
3365 if (backlist->nargs == MANY) /* FIXME: Can this happen? */ 3358 if (backlist->nargs == MANY) /* FIXME: Can this happen? */
@@ -3367,7 +3360,7 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3367 else 3360 else
3368 tem = Flist (backlist->nargs, backlist->args); 3361 tem = Flist (backlist->nargs, backlist->args);
3369 3362
3370 return Fcons (Qt, Fcons (*backlist->function, tem)); 3363 return Fcons (Qt, Fcons (backlist->function, tem));
3371 } 3364 }
3372} 3365}
3373 3366