diff options
| author | Daniel Colascione | 2012-09-17 04:07:36 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2012-09-17 04:07:36 -0800 |
| commit | 2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (patch) | |
| tree | 6dd6784d63e54cb18071df8e28fbdbc27d418728 /src/eval.c | |
| parent | f701ab72dd55460d23c8b029550aa4d7ecef3cfa (diff) | |
| parent | bb7dce392f6d9d5fc4b9d7de09ff920a52f07669 (diff) | |
| download | emacs-2ab329f3b5d52a39f0a45c3d9c129f1c19560142.tar.gz emacs-2ab329f3b5d52a39f0a45c3d9c129f1c19560142.zip | |
Merge from trunk
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 130 |
1 files changed, 58 insertions, 72 deletions
diff --git a/src/eval.c b/src/eval.c index c56be10c5a0..1c565e233c6 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | #include <limits.h> | 21 | #include <limits.h> |
| 22 | #include <setjmp.h> | ||
| 23 | #include <stdio.h> | 22 | #include <stdio.h> |
| 24 | #include "lisp.h" | 23 | #include "lisp.h" |
| 25 | #include "blockinput.h" | 24 | #include "blockinput.h" |
| @@ -69,7 +68,7 @@ Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp; | |||
| 69 | Lisp_Object Qinhibit_quit; | 68 | Lisp_Object Qinhibit_quit; |
| 70 | Lisp_Object Qand_rest; | 69 | Lisp_Object Qand_rest; |
| 71 | static Lisp_Object Qand_optional; | 70 | static Lisp_Object Qand_optional; |
| 72 | static Lisp_Object Qdebug_on_error; | 71 | static Lisp_Object Qinhibit_debugger; |
| 73 | static Lisp_Object Qdeclare; | 72 | static Lisp_Object Qdeclare; |
| 74 | Lisp_Object Qinternal_interpreter_environment, Qclosure; | 73 | Lisp_Object Qinternal_interpreter_environment, Qclosure; |
| 75 | 74 | ||
| @@ -118,12 +117,6 @@ static EMACS_INT when_entered_debugger; | |||
| 118 | 117 | ||
| 119 | Lisp_Object Vsignaling_function; | 118 | Lisp_Object Vsignaling_function; |
| 120 | 119 | ||
| 121 | /* Set to non-zero while processing X events. Checked in Feval to | ||
| 122 | make sure the Lisp interpreter isn't called from a signal handler, | ||
| 123 | which is unsafe because the interpreter isn't reentrant. */ | ||
| 124 | |||
| 125 | int handling_signal; | ||
| 126 | |||
| 127 | /* If non-nil, Lisp code must not be run since some part of Emacs is | 120 | /* 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 | 121 | in an inconsistent state. Currently, x-create-frame uses this to |
| 129 | avoid triggering window-configuration-change-hook while the new | 122 | avoid triggering window-configuration-change-hook while the new |
| @@ -131,7 +124,7 @@ int handling_signal; | |||
| 131 | Lisp_Object inhibit_lisp_code; | 124 | Lisp_Object inhibit_lisp_code; |
| 132 | 125 | ||
| 133 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); | 126 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); |
| 134 | static int interactive_p (int); | 127 | static bool interactive_p (void); |
| 135 | static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); | 128 | static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); |
| 136 | 129 | ||
| 137 | /* Functions to set Lisp_Object slots of struct specbinding. */ | 130 | /* Functions to set Lisp_Object slots of struct specbinding. */ |
| @@ -191,10 +184,10 @@ restore_stack_limits (Lisp_Object data) | |||
| 191 | 184 | ||
| 192 | /* Call the Lisp debugger, giving it argument ARG. */ | 185 | /* Call the Lisp debugger, giving it argument ARG. */ |
| 193 | 186 | ||
| 194 | static Lisp_Object | 187 | Lisp_Object |
| 195 | call_debugger (Lisp_Object arg) | 188 | call_debugger (Lisp_Object arg) |
| 196 | { | 189 | { |
| 197 | int debug_while_redisplaying; | 190 | bool debug_while_redisplaying; |
| 198 | ptrdiff_t count = SPECPDL_INDEX (); | 191 | ptrdiff_t count = SPECPDL_INDEX (); |
| 199 | Lisp_Object val; | 192 | Lisp_Object val; |
| 200 | EMACS_INT old_max = max_specpdl_size; | 193 | EMACS_INT old_max = max_specpdl_size; |
| @@ -229,7 +222,7 @@ call_debugger (Lisp_Object arg) | |||
| 229 | specbind (intern ("debugger-may-continue"), | 222 | specbind (intern ("debugger-may-continue"), |
| 230 | debug_while_redisplaying ? Qnil : Qt); | 223 | debug_while_redisplaying ? Qnil : Qt); |
| 231 | specbind (Qinhibit_redisplay, Qnil); | 224 | specbind (Qinhibit_redisplay, Qnil); |
| 232 | specbind (Qdebug_on_error, Qnil); | 225 | specbind (Qinhibit_debugger, Qt); |
| 233 | 226 | ||
| 234 | #if 0 /* Binding this prevents execution of Lisp code during | 227 | #if 0 /* Binding this prevents execution of Lisp code during |
| 235 | redisplay, which necessarily leads to display problems. */ | 228 | redisplay, which necessarily leads to display problems. */ |
| @@ -525,7 +518,7 @@ spec that specifies non-nil unconditionally (such as \"p\"); or (ii) | |||
| 525 | use `called-interactively-p'. */) | 518 | use `called-interactively-p'. */) |
| 526 | (void) | 519 | (void) |
| 527 | { | 520 | { |
| 528 | return interactive_p (1) ? Qt : Qnil; | 521 | return interactive_p () ? Qt : Qnil; |
| 529 | } | 522 | } |
| 530 | 523 | ||
| 531 | 524 | ||
| @@ -550,19 +543,17 @@ non-nil unconditionally (\"p\" is a good way to do this), or via | |||
| 550 | \(not (or executing-kbd-macro noninteractive)). */) | 543 | \(not (or executing-kbd-macro noninteractive)). */) |
| 551 | (Lisp_Object kind) | 544 | (Lisp_Object kind) |
| 552 | { | 545 | { |
| 553 | return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) | 546 | return (((INTERACTIVE || !EQ (kind, intern ("interactive"))) |
| 554 | && interactive_p (1)) ? Qt : Qnil; | 547 | && interactive_p ()) |
| 548 | ? Qt : Qnil); | ||
| 555 | } | 549 | } |
| 556 | 550 | ||
| 557 | 551 | ||
| 558 | /* Return 1 if function in which this appears was called using | 552 | /* Return true if function in which this appears was called using |
| 559 | call-interactively. | 553 | call-interactively and is not a built-in. */ |
| 560 | 554 | ||
| 561 | EXCLUDE_SUBRS_P non-zero means always return 0 if the function | 555 | static bool |
| 562 | called is a built-in. */ | 556 | interactive_p (void) |
| 563 | |||
| 564 | static int | ||
| 565 | interactive_p (int exclude_subrs_p) | ||
| 566 | { | 557 | { |
| 567 | struct backtrace *btp; | 558 | struct backtrace *btp; |
| 568 | Lisp_Object fun; | 559 | Lisp_Object fun; |
| @@ -591,9 +582,9 @@ interactive_p (int exclude_subrs_p) | |||
| 591 | /* `btp' now points at the frame of the innermost function that isn't | 582 | /* `btp' now points at the frame of the innermost function that isn't |
| 592 | a special form, ignoring frames for Finteractive_p and/or | 583 | a special form, ignoring frames for Finteractive_p and/or |
| 593 | Fbytecode at the top. If this frame is for a built-in function | 584 | Fbytecode at the top. If this frame is for a built-in function |
| 594 | (such as load or eval-region) return nil. */ | 585 | (such as load or eval-region) return false. */ |
| 595 | fun = Findirect_function (*btp->function, Qnil); | 586 | fun = Findirect_function (*btp->function, Qnil); |
| 596 | if (exclude_subrs_p && SUBRP (fun)) | 587 | if (SUBRP (fun)) |
| 597 | return 0; | 588 | return 0; |
| 598 | 589 | ||
| 599 | /* `btp' points to the frame of a Lisp function that called interactive-p. | 590 | /* `btp' points to the frame of a Lisp function that called interactive-p. |
| @@ -709,7 +700,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 709 | else | 700 | else |
| 710 | { /* Check if there is really a global binding rather than just a let | 701 | { /* Check if there is really a global binding rather than just a let |
| 711 | binding that shadows the global unboundness of the var. */ | 702 | binding that shadows the global unboundness of the var. */ |
| 712 | volatile struct specbinding *pdl = specpdl_ptr; | 703 | struct specbinding *pdl = specpdl_ptr; |
| 713 | while (pdl > specpdl) | 704 | while (pdl > specpdl) |
| 714 | { | 705 | { |
| 715 | if (EQ ((--pdl)->symbol, sym) && !pdl->func | 706 | if (EQ ((--pdl)->symbol, sym) && !pdl->func |
| @@ -1074,7 +1065,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object | |||
| 1074 | catchlist = &c; | 1065 | catchlist = &c; |
| 1075 | 1066 | ||
| 1076 | /* Call FUNC. */ | 1067 | /* Call FUNC. */ |
| 1077 | if (! _setjmp (c.jmp)) | 1068 | if (! sys_setjmp (c.jmp)) |
| 1078 | c.val = (*func) (arg); | 1069 | c.val = (*func) (arg); |
| 1079 | 1070 | ||
| 1080 | /* Throw works by a longjmp that comes right here. */ | 1071 | /* Throw works by a longjmp that comes right here. */ |
| @@ -1101,7 +1092,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object | |||
| 1101 | static _Noreturn void | 1092 | static _Noreturn void |
| 1102 | unwind_to_catch (struct catchtag *catch, Lisp_Object value) | 1093 | unwind_to_catch (struct catchtag *catch, Lisp_Object value) |
| 1103 | { | 1094 | { |
| 1104 | int last_time; | 1095 | bool last_time; |
| 1105 | 1096 | ||
| 1106 | /* Save the value in the tag. */ | 1097 | /* Save the value in the tag. */ |
| 1107 | catch->val = value; | 1098 | catch->val = value; |
| @@ -1109,7 +1100,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1109 | /* Restore certain special C variables. */ | 1100 | /* Restore certain special C variables. */ |
| 1110 | set_poll_suppress_count (catch->poll_suppress_count); | 1101 | set_poll_suppress_count (catch->poll_suppress_count); |
| 1111 | UNBLOCK_INPUT_TO (catch->interrupt_input_blocked); | 1102 | UNBLOCK_INPUT_TO (catch->interrupt_input_blocked); |
| 1112 | handling_signal = 0; | ||
| 1113 | immediate_quit = 0; | 1103 | immediate_quit = 0; |
| 1114 | 1104 | ||
| 1115 | do | 1105 | do |
| @@ -1142,7 +1132,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value) | |||
| 1142 | backtrace_list = catch->backlist; | 1132 | backtrace_list = catch->backlist; |
| 1143 | lisp_eval_depth = catch->lisp_eval_depth; | 1133 | lisp_eval_depth = catch->lisp_eval_depth; |
| 1144 | 1134 | ||
| 1145 | _longjmp (catch->jmp, 1); | 1135 | sys_longjmp (catch->jmp, 1); |
| 1146 | } | 1136 | } |
| 1147 | 1137 | ||
| 1148 | DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, | 1138 | DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, |
| @@ -1206,12 +1196,9 @@ See also the function `signal' for more info. | |||
| 1206 | usage: (condition-case VAR BODYFORM &rest HANDLERS) */) | 1196 | usage: (condition-case VAR BODYFORM &rest HANDLERS) */) |
| 1207 | (Lisp_Object args) | 1197 | (Lisp_Object args) |
| 1208 | { | 1198 | { |
| 1209 | register Lisp_Object bodyform, handlers; | 1199 | Lisp_Object var = Fcar (args); |
| 1210 | volatile Lisp_Object var; | 1200 | Lisp_Object bodyform = Fcar (Fcdr (args)); |
| 1211 | 1201 | Lisp_Object handlers = Fcdr (Fcdr (args)); | |
| 1212 | var = Fcar (args); | ||
| 1213 | bodyform = Fcar (Fcdr (args)); | ||
| 1214 | handlers = Fcdr (Fcdr (args)); | ||
| 1215 | 1202 | ||
| 1216 | return internal_lisp_condition_case (var, bodyform, handlers); | 1203 | return internal_lisp_condition_case (var, bodyform, handlers); |
| 1217 | } | 1204 | } |
| @@ -1251,7 +1238,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, | |||
| 1251 | c.interrupt_input_blocked = interrupt_input_blocked; | 1238 | c.interrupt_input_blocked = interrupt_input_blocked; |
| 1252 | c.gcpro = gcprolist; | 1239 | c.gcpro = gcprolist; |
| 1253 | c.byte_stack = byte_stack_list; | 1240 | c.byte_stack = byte_stack_list; |
| 1254 | if (_setjmp (c.jmp)) | 1241 | if (sys_setjmp (c.jmp)) |
| 1255 | { | 1242 | { |
| 1256 | if (!NILP (h.var)) | 1243 | if (!NILP (h.var)) |
| 1257 | specbind (h.var, c.val); | 1244 | specbind (h.var, c.val); |
| @@ -1306,7 +1293,7 @@ internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers, | |||
| 1306 | c.interrupt_input_blocked = interrupt_input_blocked; | 1293 | c.interrupt_input_blocked = interrupt_input_blocked; |
| 1307 | c.gcpro = gcprolist; | 1294 | c.gcpro = gcprolist; |
| 1308 | c.byte_stack = byte_stack_list; | 1295 | c.byte_stack = byte_stack_list; |
| 1309 | if (_setjmp (c.jmp)) | 1296 | if (sys_setjmp (c.jmp)) |
| 1310 | { | 1297 | { |
| 1311 | return (*hfun) (c.val); | 1298 | return (*hfun) (c.val); |
| 1312 | } | 1299 | } |
| @@ -1344,7 +1331,7 @@ internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg, | |||
| 1344 | c.interrupt_input_blocked = interrupt_input_blocked; | 1331 | c.interrupt_input_blocked = interrupt_input_blocked; |
| 1345 | c.gcpro = gcprolist; | 1332 | c.gcpro = gcprolist; |
| 1346 | c.byte_stack = byte_stack_list; | 1333 | c.byte_stack = byte_stack_list; |
| 1347 | if (_setjmp (c.jmp)) | 1334 | if (sys_setjmp (c.jmp)) |
| 1348 | { | 1335 | { |
| 1349 | return (*hfun) (c.val); | 1336 | return (*hfun) (c.val); |
| 1350 | } | 1337 | } |
| @@ -1386,7 +1373,7 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), | |||
| 1386 | c.interrupt_input_blocked = interrupt_input_blocked; | 1373 | c.interrupt_input_blocked = interrupt_input_blocked; |
| 1387 | c.gcpro = gcprolist; | 1374 | c.gcpro = gcprolist; |
| 1388 | c.byte_stack = byte_stack_list; | 1375 | c.byte_stack = byte_stack_list; |
| 1389 | if (_setjmp (c.jmp)) | 1376 | if (sys_setjmp (c.jmp)) |
| 1390 | { | 1377 | { |
| 1391 | return (*hfun) (c.val); | 1378 | return (*hfun) (c.val); |
| 1392 | } | 1379 | } |
| @@ -1430,7 +1417,7 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), | |||
| 1430 | c.interrupt_input_blocked = interrupt_input_blocked; | 1417 | c.interrupt_input_blocked = interrupt_input_blocked; |
| 1431 | c.gcpro = gcprolist; | 1418 | c.gcpro = gcprolist; |
| 1432 | c.byte_stack = byte_stack_list; | 1419 | c.byte_stack = byte_stack_list; |
| 1433 | if (_setjmp (c.jmp)) | 1420 | if (sys_setjmp (c.jmp)) |
| 1434 | { | 1421 | { |
| 1435 | return (*hfun) (c.val, nargs, args); | 1422 | return (*hfun) (c.val, nargs, args); |
| 1436 | } | 1423 | } |
| @@ -1450,8 +1437,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), | |||
| 1450 | 1437 | ||
| 1451 | 1438 | ||
| 1452 | static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object); | 1439 | static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object); |
| 1453 | static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, | 1440 | static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, |
| 1454 | Lisp_Object data); | 1441 | Lisp_Object data); |
| 1455 | 1442 | ||
| 1456 | void | 1443 | void |
| 1457 | process_quit_flag (void) | 1444 | process_quit_flag (void) |
| @@ -1492,10 +1479,10 @@ See also the function `condition-case'. */) | |||
| 1492 | struct handler *h; | 1479 | struct handler *h; |
| 1493 | struct backtrace *bp; | 1480 | struct backtrace *bp; |
| 1494 | 1481 | ||
| 1495 | immediate_quit = handling_signal = 0; | 1482 | immediate_quit = 0; |
| 1496 | abort_on_gc = 0; | 1483 | abort_on_gc = 0; |
| 1497 | if (gc_in_progress || waiting_for_input) | 1484 | if (gc_in_progress || waiting_for_input) |
| 1498 | abort (); | 1485 | emacs_abort (); |
| 1499 | 1486 | ||
| 1500 | #if 0 /* rms: I don't know why this was here, | 1487 | #if 0 /* rms: I don't know why this was here, |
| 1501 | but it is surely wrong for an error that is handled. */ | 1488 | but it is surely wrong for an error that is handled. */ |
| @@ -1556,7 +1543,7 @@ See also the function `condition-case'. */) | |||
| 1556 | if requested". */ | 1543 | if requested". */ |
| 1557 | || EQ (h->handler, Qerror))) | 1544 | || EQ (h->handler, Qerror))) |
| 1558 | { | 1545 | { |
| 1559 | int debugger_called | 1546 | bool debugger_called |
| 1560 | = maybe_call_debugger (conditions, error_symbol, data); | 1547 | = maybe_call_debugger (conditions, error_symbol, data); |
| 1561 | /* We can't return values to code which signaled an error, but we | 1548 | /* We can't return values to code which signaled an error, but we |
| 1562 | can continue code which has signaled a quit. */ | 1549 | can continue code which has signaled a quit. */ |
| @@ -1592,7 +1579,7 @@ void | |||
| 1592 | xsignal (Lisp_Object error_symbol, Lisp_Object data) | 1579 | xsignal (Lisp_Object error_symbol, Lisp_Object data) |
| 1593 | { | 1580 | { |
| 1594 | Fsignal (error_symbol, data); | 1581 | Fsignal (error_symbol, data); |
| 1595 | abort (); | 1582 | emacs_abort (); |
| 1596 | } | 1583 | } |
| 1597 | 1584 | ||
| 1598 | /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ | 1585 | /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ |
| @@ -1650,10 +1637,10 @@ signal_error (const char *s, Lisp_Object arg) | |||
| 1650 | } | 1637 | } |
| 1651 | 1638 | ||
| 1652 | 1639 | ||
| 1653 | /* Return nonzero if LIST is a non-nil atom or | 1640 | /* Return true if LIST is a non-nil atom or |
| 1654 | a list containing one of CONDITIONS. */ | 1641 | a list containing one of CONDITIONS. */ |
| 1655 | 1642 | ||
| 1656 | static int | 1643 | static bool |
| 1657 | wants_debugger (Lisp_Object list, Lisp_Object conditions) | 1644 | wants_debugger (Lisp_Object list, Lisp_Object conditions) |
| 1658 | { | 1645 | { |
| 1659 | if (NILP (list)) | 1646 | if (NILP (list)) |
| @@ -1673,15 +1660,15 @@ wants_debugger (Lisp_Object list, Lisp_Object conditions) | |||
| 1673 | return 0; | 1660 | return 0; |
| 1674 | } | 1661 | } |
| 1675 | 1662 | ||
| 1676 | /* Return 1 if an error with condition-symbols CONDITIONS, | 1663 | /* Return true if an error with condition-symbols CONDITIONS, |
| 1677 | and described by SIGNAL-DATA, should skip the debugger | 1664 | and described by SIGNAL-DATA, should skip the debugger |
| 1678 | according to debugger-ignored-errors. */ | 1665 | according to debugger-ignored-errors. */ |
| 1679 | 1666 | ||
| 1680 | static int | 1667 | static bool |
| 1681 | skip_debugger (Lisp_Object conditions, Lisp_Object data) | 1668 | skip_debugger (Lisp_Object conditions, Lisp_Object data) |
| 1682 | { | 1669 | { |
| 1683 | Lisp_Object tail; | 1670 | Lisp_Object tail; |
| 1684 | int first_string = 1; | 1671 | bool first_string = 1; |
| 1685 | Lisp_Object error_message; | 1672 | Lisp_Object error_message; |
| 1686 | 1673 | ||
| 1687 | error_message = Qnil; | 1674 | error_message = Qnil; |
| @@ -1716,7 +1703,7 @@ skip_debugger (Lisp_Object conditions, Lisp_Object data) | |||
| 1716 | = SIG is the error symbol, and DATA is the rest of the data. | 1703 | = SIG is the error symbol, and DATA is the rest of the data. |
| 1717 | = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). | 1704 | = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). |
| 1718 | This is for memory-full errors only. */ | 1705 | This is for memory-full errors only. */ |
| 1719 | static int | 1706 | static bool |
| 1720 | maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) | 1707 | maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) |
| 1721 | { | 1708 | { |
| 1722 | Lisp_Object combined_data; | 1709 | Lisp_Object combined_data; |
| @@ -1727,6 +1714,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) | |||
| 1727 | /* Don't try to run the debugger with interrupts blocked. | 1714 | /* Don't try to run the debugger with interrupts blocked. |
| 1728 | The editing loop would return anyway. */ | 1715 | The editing loop would return anyway. */ |
| 1729 | ! INPUT_BLOCKED_P | 1716 | ! INPUT_BLOCKED_P |
| 1717 | && NILP (Vinhibit_debugger) | ||
| 1730 | /* Does user want to enter debugger for this kind of error? */ | 1718 | /* Does user want to enter debugger for this kind of error? */ |
| 1731 | && (EQ (sig, Qquit) | 1719 | && (EQ (sig, Qquit) |
| 1732 | ? debug_on_quit | 1720 | ? debug_on_quit |
| @@ -2044,9 +2032,6 @@ eval_sub (Lisp_Object form) | |||
| 2044 | struct backtrace backtrace; | 2032 | struct backtrace backtrace; |
| 2045 | struct gcpro gcpro1, gcpro2, gcpro3; | 2033 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2046 | 2034 | ||
| 2047 | if (handling_signal) | ||
| 2048 | abort (); | ||
| 2049 | |||
| 2050 | if (SYMBOLP (form)) | 2035 | if (SYMBOLP (form)) |
| 2051 | { | 2036 | { |
| 2052 | /* Look up its binding in the lexical environment. | 2037 | /* Look up its binding in the lexical environment. |
| @@ -2209,7 +2194,7 @@ eval_sub (Lisp_Object form) | |||
| 2209 | is supported by this code. We need to either rewrite the | 2194 | is supported by this code. We need to either rewrite the |
| 2210 | subr to use a different argument protocol, or add more | 2195 | subr to use a different argument protocol, or add more |
| 2211 | cases to this switch. */ | 2196 | cases to this switch. */ |
| 2212 | abort (); | 2197 | emacs_abort (); |
| 2213 | } | 2198 | } |
| 2214 | } | 2199 | } |
| 2215 | } | 2200 | } |
| @@ -2232,7 +2217,6 @@ eval_sub (Lisp_Object form) | |||
| 2232 | if (EQ (funcar, Qmacro)) | 2217 | if (EQ (funcar, Qmacro)) |
| 2233 | { | 2218 | { |
| 2234 | ptrdiff_t count = SPECPDL_INDEX (); | 2219 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2235 | extern Lisp_Object Qlexical_binding; | ||
| 2236 | Lisp_Object exp; | 2220 | Lisp_Object exp; |
| 2237 | /* Bind lexical-binding during expansion of the macro, so the | 2221 | /* Bind lexical-binding during expansion of the macro, so the |
| 2238 | macro can know reliably if the code it outputs will be | 2222 | macro can know reliably if the code it outputs will be |
| @@ -2853,7 +2837,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2853 | /* If a subr takes more than 8 arguments without using MANY | 2837 | /* If a subr takes more than 8 arguments without using MANY |
| 2854 | or UNEVALLED, we need to extend this function to support it. | 2838 | or UNEVALLED, we need to extend this function to support it. |
| 2855 | Until this is done, there is no way to call the function. */ | 2839 | Until this is done, there is no way to call the function. */ |
| 2856 | abort (); | 2840 | emacs_abort (); |
| 2857 | } | 2841 | } |
| 2858 | } | 2842 | } |
| 2859 | } | 2843 | } |
| @@ -2940,7 +2924,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, | |||
| 2940 | Lisp_Object val, syms_left, next, lexenv; | 2924 | Lisp_Object val, syms_left, next, lexenv; |
| 2941 | ptrdiff_t count = SPECPDL_INDEX (); | 2925 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2942 | ptrdiff_t i; | 2926 | ptrdiff_t i; |
| 2943 | int optional, rest; | 2927 | bool optional, rest; |
| 2944 | 2928 | ||
| 2945 | if (CONSP (fun)) | 2929 | if (CONSP (fun)) |
| 2946 | { | 2930 | { |
| @@ -2984,7 +2968,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, | |||
| 2984 | lexenv = Qnil; | 2968 | lexenv = Qnil; |
| 2985 | } | 2969 | } |
| 2986 | else | 2970 | else |
| 2987 | abort (); | 2971 | emacs_abort (); |
| 2988 | 2972 | ||
| 2989 | i = optional = rest = 0; | 2973 | i = optional = rest = 0; |
| 2990 | for (; CONSP (syms_left); syms_left = XCDR (syms_left)) | 2974 | for (; CONSP (syms_left); syms_left = XCDR (syms_left)) |
| @@ -3110,8 +3094,6 @@ specbind (Lisp_Object symbol, Lisp_Object value) | |||
| 3110 | { | 3094 | { |
| 3111 | struct Lisp_Symbol *sym; | 3095 | struct Lisp_Symbol *sym; |
| 3112 | 3096 | ||
| 3113 | eassert (!handling_signal); | ||
| 3114 | |||
| 3115 | CHECK_SYMBOL (symbol); | 3097 | CHECK_SYMBOL (symbol); |
| 3116 | sym = XSYMBOL (symbol); | 3098 | sym = XSYMBOL (symbol); |
| 3117 | if (specpdl_ptr == specpdl + specpdl_size) | 3099 | if (specpdl_ptr == specpdl + specpdl_size) |
| @@ -3198,15 +3180,13 @@ specbind (Lisp_Object symbol, Lisp_Object value) | |||
| 3198 | set_internal (symbol, value, Qnil, 1); | 3180 | set_internal (symbol, value, Qnil, 1); |
| 3199 | break; | 3181 | break; |
| 3200 | } | 3182 | } |
| 3201 | default: abort (); | 3183 | default: emacs_abort (); |
| 3202 | } | 3184 | } |
| 3203 | } | 3185 | } |
| 3204 | 3186 | ||
| 3205 | void | 3187 | void |
| 3206 | record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg) | 3188 | record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg) |
| 3207 | { | 3189 | { |
| 3208 | eassert (!handling_signal); | ||
| 3209 | |||
| 3210 | if (specpdl_ptr == specpdl + specpdl_size) | 3190 | if (specpdl_ptr == specpdl + specpdl_size) |
| 3211 | grow_specpdl (); | 3191 | grow_specpdl (); |
| 3212 | specpdl_ptr->func = function; | 3192 | specpdl_ptr->func = function; |
| @@ -3343,13 +3323,13 @@ Output stream used is value of `standard-output'. */) | |||
| 3343 | write_string ("(", -1); | 3323 | write_string ("(", -1); |
| 3344 | if (backlist->nargs == MANY) | 3324 | if (backlist->nargs == MANY) |
| 3345 | { /* FIXME: Can this happen? */ | 3325 | { /* FIXME: Can this happen? */ |
| 3346 | int i; | 3326 | bool later_arg = 0; |
| 3347 | for (tail = *backlist->args, i = 0; | 3327 | for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail)) |
| 3348 | !NILP (tail); | ||
| 3349 | tail = Fcdr (tail), i = 1) | ||
| 3350 | { | 3328 | { |
| 3351 | if (i) write_string (" ", -1); | 3329 | if (later_arg) |
| 3330 | write_string (" ", -1); | ||
| 3352 | Fprin1 (Fcar (tail), Qnil); | 3331 | Fprin1 (Fcar (tail), Qnil); |
| 3332 | later_arg = 1; | ||
| 3353 | } | 3333 | } |
| 3354 | } | 3334 | } |
| 3355 | else | 3335 | else |
| @@ -3470,7 +3450,7 @@ before making `inhibit-quit' nil. */); | |||
| 3470 | 3450 | ||
| 3471 | DEFSYM (Qinhibit_quit, "inhibit-quit"); | 3451 | DEFSYM (Qinhibit_quit, "inhibit-quit"); |
| 3472 | DEFSYM (Qautoload, "autoload"); | 3452 | DEFSYM (Qautoload, "autoload"); |
| 3473 | DEFSYM (Qdebug_on_error, "debug-on-error"); | 3453 | DEFSYM (Qinhibit_debugger, "inhibit-debugger"); |
| 3474 | DEFSYM (Qmacro, "macro"); | 3454 | DEFSYM (Qmacro, "macro"); |
| 3475 | DEFSYM (Qdeclare, "declare"); | 3455 | DEFSYM (Qdeclare, "declare"); |
| 3476 | 3456 | ||
| @@ -3485,6 +3465,12 @@ before making `inhibit-quit' nil. */); | |||
| 3485 | DEFSYM (Qclosure, "closure"); | 3465 | DEFSYM (Qclosure, "closure"); |
| 3486 | DEFSYM (Qdebug, "debug"); | 3466 | DEFSYM (Qdebug, "debug"); |
| 3487 | 3467 | ||
| 3468 | DEFVAR_LISP ("inhibit-debugger", Vinhibit_debugger, | ||
| 3469 | doc: /* Non-nil means never enter the debugger. | ||
| 3470 | Normally set while the debugger is already active, to avoid recursive | ||
| 3471 | invocations. */); | ||
| 3472 | Vinhibit_debugger = Qnil; | ||
| 3473 | |||
| 3488 | DEFVAR_LISP ("debug-on-error", Vdebug_on_error, | 3474 | DEFVAR_LISP ("debug-on-error", Vdebug_on_error, |
| 3489 | doc: /* Non-nil means enter debugger if an error is signaled. | 3475 | doc: /* Non-nil means enter debugger if an error is signaled. |
| 3490 | Does not apply to errors handled by `condition-case' or those | 3476 | Does not apply to errors handled by `condition-case' or those |
| @@ -3494,7 +3480,7 @@ if one of its condition symbols appears in the list. | |||
| 3494 | When you evaluate an expression interactively, this variable | 3480 | When you evaluate an expression interactively, this variable |
| 3495 | is temporarily non-nil if `eval-expression-debug-on-error' is non-nil. | 3481 | is temporarily non-nil if `eval-expression-debug-on-error' is non-nil. |
| 3496 | The command `toggle-debug-on-error' toggles this. | 3482 | The command `toggle-debug-on-error' toggles this. |
| 3497 | See also the variable `debug-on-quit'. */); | 3483 | See also the variable `debug-on-quit' and `inhibit-debugger'. */); |
| 3498 | Vdebug_on_error = Qnil; | 3484 | Vdebug_on_error = Qnil; |
| 3499 | 3485 | ||
| 3500 | DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors, | 3486 | DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors, |