aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/eval.c b/src/eval.c
index 72facd5db64..33b82f74b64 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1431,6 +1431,7 @@ push_handler_nosignal (Lisp_Object tag_ch_val, enum handlertype handlertype)
1431} 1431}
1432 1432
1433 1433
1434static Lisp_Object signal_or_quit (Lisp_Object, Lisp_Object, bool);
1434static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object); 1435static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object);
1435static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, 1436static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
1436 Lisp_Object data); 1437 Lisp_Object data);
@@ -1444,7 +1445,7 @@ process_quit_flag (void)
1444 Fkill_emacs (Qnil); 1445 Fkill_emacs (Qnil);
1445 if (EQ (Vthrow_on_input, flag)) 1446 if (EQ (Vthrow_on_input, flag))
1446 Fthrow (Vthrow_on_input, Qt); 1447 Fthrow (Vthrow_on_input, Qt);
1447 Fsignal (Qquit, Qnil); 1448 quit ();
1448} 1449}
1449 1450
1450DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0, 1451DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0,
@@ -1460,9 +1461,29 @@ DATA should be a list. Its elements are printed as part of the error message.
1460See Info anchor `(elisp)Definition of signal' for some details on how this 1461See Info anchor `(elisp)Definition of signal' for some details on how this
1461error message is constructed. 1462error message is constructed.
1462If the signal is handled, DATA is made available to the handler. 1463If the signal is handled, DATA is made available to the handler.
1463See also the function `condition-case'. */) 1464See also the function `condition-case'. */
1465 attributes: noreturn)
1464 (Lisp_Object error_symbol, Lisp_Object data) 1466 (Lisp_Object error_symbol, Lisp_Object data)
1465{ 1467{
1468 signal_or_quit (error_symbol, data, false);
1469 eassume (false);
1470}
1471
1472/* Quit, in response to a keyboard quit request. */
1473Lisp_Object
1474quit (void)
1475{
1476 return signal_or_quit (Qquit, Qnil, true);
1477}
1478
1479/* Signal an error, or quit. ERROR_SYMBOL and DATA are as with Fsignal.
1480 If KEYBOARD_QUIT, this is a quit; ERROR_SYMBOL should be
1481 Qquit and DATA should be Qnil, and this function may return.
1482 Otherwise this function is like Fsignal and does not return. */
1483
1484static Lisp_Object
1485signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit)
1486{
1466 /* When memory is full, ERROR-SYMBOL is nil, 1487 /* When memory is full, ERROR-SYMBOL is nil,
1467 and DATA is (REAL-ERROR-SYMBOL . REAL-DATA). 1488 and DATA is (REAL-ERROR-SYMBOL . REAL-DATA).
1468 That is a special case--don't do this in other situations. */ 1489 That is a special case--don't do this in other situations. */
@@ -1542,7 +1563,7 @@ See also the function `condition-case'. */)
1542 = maybe_call_debugger (conditions, error_symbol, data); 1563 = maybe_call_debugger (conditions, error_symbol, data);
1543 /* We can't return values to code which signaled an error, but we 1564 /* We can't return values to code which signaled an error, but we
1544 can continue code which has signaled a quit. */ 1565 can continue code which has signaled a quit. */
1545 if (debugger_called && EQ (real_error_symbol, Qquit)) 1566 if (keyboard_quit && debugger_called && EQ (real_error_symbol, Qquit))
1546 return Qnil; 1567 return Qnil;
1547 } 1568 }
1548 1569
@@ -1569,16 +1590,6 @@ See also the function `condition-case'. */)
1569 fatal ("%s", SDATA (string)); 1590 fatal ("%s", SDATA (string));
1570} 1591}
1571 1592
1572/* Internal version of Fsignal that never returns.
1573 Used for anything but Qquit (which can return from Fsignal). */
1574
1575void
1576xsignal (Lisp_Object error_symbol, Lisp_Object data)
1577{
1578 Fsignal (error_symbol, data);
1579 emacs_abort ();
1580}
1581
1582/* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ 1593/* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */
1583 1594
1584void 1595void