Commit 3b1c4207 authored by Stefan Monnier's avatar Stefan Monnier

* src/xdisp.c: Bind inhibit-quit during pre-redisplay-function.

(safe__call, safe__call1, safe__eval): New functions.
(safe_call): Use it.
(prepare_menu_bars): Use it for pre-redisplay-function.
(display_mode_element): Same for `:eval'.

Fixes: debbugs:17577
parent 486eebac
2014-05-24 Stefan Monnier <monnier@iro.umontreal.ca>
* xdisp.c: Bind inhibit-quit during pre-redisplay-function.
(safe__call, safe__call1, safe__eval): New functions.
(safe_call): Use it.
(prepare_menu_bars): Use it for pre-redisplay-function (bug#17577).
(display_mode_element): Same for `:eval'.
2014-05-22 Paul Eggert <eggert@cs.ucla.edu>
Fix port to 32-bit AIX (Bug#17540).
......
......@@ -2591,8 +2591,8 @@ safe_eval_handler (Lisp_Object arg, ptrdiff_t nargs, Lisp_Object *args)
following. Return the result, or nil if something went
wrong. Prevent redisplay during the evaluation. */
Lisp_Object
safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
static Lisp_Object
safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, ...)
{
Lisp_Object val;
......@@ -2615,6 +2615,8 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
GCPRO1 (args[0]);
gcpro1.nvars = nargs;
specbind (Qinhibit_redisplay, Qt);
if (inhibit_quit)
specbind (Qinhibit_quit, Qt);
/* Use Qt to ensure debugger does not run,
so there is no possibility of wanting to redisplay. */
val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
......@@ -2626,6 +2628,11 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
return val;
}
Lisp_Object
safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
{
return safe__call (false, nargs, func);
}
/* Call function FN with one argument ARG.
Return the result, or nil if something went wrong. */
......@@ -2633,7 +2640,13 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
Lisp_Object
safe_call1 (Lisp_Object fn, Lisp_Object arg)
{
return safe_call (2, fn, arg);
return safe__call (false, 2, fn, arg);
}
Lisp_Object
safe__call1 (bool inhibit_quit, Lisp_Object fn, Lisp_Object arg)
{
return safe__call (inhibit_quit, 2, fn, arg);
}
static Lisp_Object Qeval;
......@@ -2641,7 +2654,13 @@ static Lisp_Object Qeval;
Lisp_Object
safe_eval (Lisp_Object sexpr)
{
return safe_call1 (Qeval, sexpr);
return safe__call1 (false, Qeval, sexpr);
}
Lisp_Object
safe__eval (bool inhibit_quit, Lisp_Object sexpr)
{
return safe__call1 (inhibit_quit, Qeval, sexpr);
}
/* Call function FN with two arguments ARG1 and ARG2.
......@@ -11549,7 +11568,7 @@ prepare_menu_bars (void)
}
}
}
safe_call1 (Vpre_redisplay_function, windows);
safe__call1 (true, Vpre_redisplay_function, windows);
}
/* Update all frame titles based on their buffer names, etc. We do
......@@ -21863,7 +21882,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
if (CONSP (XCDR (elt)))
{
Lisp_Object spec;
spec = safe_eval (XCAR (XCDR (elt)));
spec = safe__eval (true, XCAR (XCDR (elt)));
n += display_mode_element (it, depth, field_width - n,
precision - n, spec, props,
risky);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment