From 3b1c4207001a24c047f73fe882ae16a1ff05cdc4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 24 May 2014 11:50:05 -0400 Subject: * 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 --- src/ChangeLog | 8 ++++++++ src/xdisp.c | 31 +++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 256eeeaa4b3..c95e0c9de15 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2014-05-24 Stefan Monnier + + * 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 Fix port to 32-bit AIX (Bug#17540). diff --git a/src/xdisp.c b/src/xdisp.c index e9c3cb1aac6..8c9884c3925 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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); -- cgit v1.2.1