diff options
| author | Joakim Verona | 2012-10-16 17:14:35 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-10-16 17:14:35 +0200 |
| commit | 017a270078be5ae39301e3205afad80d23facbbc (patch) | |
| tree | 5c85d8c3890f3a0cead231e87823b621a8f28e16 /src/eval.c | |
| parent | 5fcc7035c884b4419a1619551222b5f28ad9906f (diff) | |
| parent | 2b794d6940aa7dc58e297b3649b7799190d71f64 (diff) | |
| download | emacs-017a270078be5ae39301e3205afad80d23facbbc.tar.gz emacs-017a270078be5ae39301e3205afad80d23facbbc.zip | |
upstream
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 77 |
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 | ||
| 122 | static inline void | 122 | static void |
| 123 | set_specpdl_symbol (Lisp_Object symbol) | 123 | set_specpdl_symbol (Lisp_Object symbol) |
| 124 | { | 124 | { |
| 125 | specpdl_ptr->symbol = symbol; | 125 | specpdl_ptr->symbol = symbol; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | static inline void | 128 | static void |
| 129 | set_specpdl_old_value (Lisp_Object oldval) | 129 | set_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) */) | |||
| 2351 | DEFUN ("run-hook-with-args", Frun_hook_with_args, | 2351 | DEFUN ("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. |
| 2354 | HOOK should be a symbol, a hook variable. If HOOK has a non-nil | 2354 | HOOK should be a symbol, a hook variable. The value of HOOK |
| 2355 | value, that value may be a function or a list of functions to be | 2355 | may be nil, a function, or a list of functions. Call each |
| 2356 | called to run the hook. If the value is a function, it is called with | 2356 | function in order with arguments ARGS. The final return value |
| 2357 | the given arguments and its return value is returned. If it is a list | 2357 | is unspecified. |
| 2358 | of functions, those functions are called, in order, | ||
| 2359 | with the given arguments ARGS. | ||
| 2360 | It is best not to depend on the value returned by `run-hook-with-args', | ||
| 2361 | as that may change. | ||
| 2362 | 2358 | ||
| 2363 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2359 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2364 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2360 | Instead, 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.) */ | ||
| 2371 | DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, | 2370 | DEFUN ("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. |
| 2374 | HOOK should be a symbol, a hook variable. If HOOK has a non-nil | 2373 | HOOK should be a symbol, a hook variable. The value of HOOK |
| 2375 | value, that value may be a function or a list of functions to be | 2374 | may be nil, a function, or a list of functions. Call each |
| 2376 | called to run the hook. If the value is a function, it is called with | 2375 | function in order with arguments ARGS, stopping at the first |
| 2377 | the given arguments and its return value is returned. | 2376 | one that returns non-nil, and return that value. Otherwise (if |
| 2378 | If it is a list of functions, those functions are called, in order, | 2377 | all functions return nil, or if there are no functions to call), |
| 2379 | with the given arguments ARGS, until one of them | 2378 | return nil. |
| 2380 | returns a non-nil value. Then we return that value. | ||
| 2381 | However, if they all return nil, we return nil. | ||
| 2382 | If the value of HOOK is nil, this function returns nil. | ||
| 2383 | 2379 | ||
| 2384 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2380 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2385 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2381 | Instead, use `add-hook' and specify t for the LOCAL argument. |
| @@ -2398,15 +2394,12 @@ funcall_not (ptrdiff_t nargs, Lisp_Object *args) | |||
| 2398 | DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, | 2394 | DEFUN ("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. |
| 2401 | HOOK should be a symbol, a hook variable. If HOOK has a non-nil | 2397 | HOOK should be a symbol, a hook variable. The value of HOOK |
| 2402 | value, that value may be a function or a list of functions to be | 2398 | may be nil, a function, or a list of functions. Call each |
| 2403 | called to run the hook. If the value is a function, it is called with | 2399 | function in order with arguments ARGS, stopping at the first |
| 2404 | the given arguments. Then we return nil if the function returns nil, | 2400 | one that returns nil, and return nil. Otherwise (if all functions |
| 2405 | and t if it returns non-nil. | 2401 | return non-nil, or if there are no functions to call), return non-nil |
| 2406 | If it is a list of functions, those functions are called, in order, | 2402 | \(do not rely on the precise return value in this case). |
| 2407 | with the given arguments ARGS, until one of them returns nil. | ||
| 2408 | Then we return nil. However, if they all return non-nil, we return t. | ||
| 2409 | If the value of HOOK is nil, this function returns t. | ||
| 2410 | 2403 | ||
| 2411 | Do not use `make-local-variable' to make a hook variable buffer-local. | 2404 | Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2412 | Instead, use `add-hook' and specify t for the LOCAL argument. | 2405 | Instead, 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 | ||