diff options
| author | Stefan Monnier | 2023-12-23 00:25:46 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2023-12-23 00:25:46 -0500 |
| commit | 0fde935b66e43e4d7ec137ba6195de993168587a (patch) | |
| tree | 345d2513c9d83f7ec4c685288c5c094c9b62bc0e /src/buffer.c | |
| parent | 9aea075f5fd6e1d6b7f6d7fe35de8f3da752c3e7 (diff) | |
| download | emacs-0fde935b66e43e4d7ec137ba6195de993168587a.tar.gz emacs-0fde935b66e43e4d7ec137ba6195de993168587a.zip | |
Split safe_call between redisplay and non-redisplay versions
The `safe_call/eval` family of functions started its life in `xdisp.c`
for the needs of redisplay but quickly became popular outside of it.
This is not ideal because despite their name, they are somewhat
specific to the needs of redisplay.
So we split them into `safe_call/eval` (in `eval.c`) and `dsafe_call/eval`
(in `xdisp.c`). We took this opportunity to slightly change their
calling convention to be friendly to the CALLN-style macros.
While at it, we introduce a new `calln` macro as well which does
all that `call[1-8]` used to do.
* src/eval.c (safe_eval_handler, safe_funcall, safe_eval): New functions,
Copied from `xdisp.c`. Don't obey `inhibit_eval_during_redisplay` any more.
Adjust error message to not claim it happened during redisplay.
* src/lisp.h (calln): New macro.
(call1, call2, call3, call4, call5, call6, call7, call8): Turn them
into aliases of `calln`.
(safe_funcall): Declare.
(safe_calln): New macro.
(safe_call1, safe_call2): Redefine as compatibility macros.
(safe_call, safe_call1, safe_call2): Delete.
Replace all callers with calls to `safe_calln`.
* src/xdisp.c (dsafe_eval_handler): Rename from `safe_eval_handler`.
Adjust all users.
(dsafe__call): Rename from `safe_call` and change calling convention to
work with something like CALLMANY. Adjust all users.
(safe_call, safe__call1, safe_call2): Delete functions.
(SAFE_CALLMANY, dsafe_calln): New macros.
(dsafe_call1, dsafe_eval): Rename from `safe_call1` and `safe_eval`,
and rewrite using them. Adjust all users.
(clear_message, prepare_menu_bars, redisplay_window): Use `dsafe_calln`.
(run_window_scroll_functions): Don't let-bind `Qinhibit_quit`
since `safe_run_hooks_2` does it for us.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c index a7299f4a49e..ea0c23192b7 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1739,7 +1739,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1739 | if (!NILP (notsogood)) | 1739 | if (!NILP (notsogood)) |
| 1740 | return notsogood; | 1740 | return notsogood; |
| 1741 | else | 1741 | else |
| 1742 | return safe_call (1, Qget_scratch_buffer_create); | 1742 | return safe_calln (Qget_scratch_buffer_create); |
| 1743 | } | 1743 | } |
| 1744 | 1744 | ||
| 1745 | /* The following function is a safe variant of Fother_buffer: It doesn't | 1745 | /* The following function is a safe variant of Fother_buffer: It doesn't |
| @@ -1760,7 +1760,7 @@ other_buffer_safely (Lisp_Object buffer) | |||
| 1760 | becoming dead under our feet. safe_call below could return nil | 1760 | becoming dead under our feet. safe_call below could return nil |
| 1761 | if recreating *scratch* in Lisp, which does some fancy stuff, | 1761 | if recreating *scratch* in Lisp, which does some fancy stuff, |
| 1762 | signals an error in some weird use case. */ | 1762 | signals an error in some weird use case. */ |
| 1763 | buf = safe_call (1, Qget_scratch_buffer_create); | 1763 | buf = safe_calln (Qget_scratch_buffer_create); |
| 1764 | if (NILP (buf)) | 1764 | if (NILP (buf)) |
| 1765 | { | 1765 | { |
| 1766 | AUTO_STRING (scratch, "*scratch*"); | 1766 | AUTO_STRING (scratch, "*scratch*"); |