aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2014-05-24 11:50:05 -0400
committerStefan Monnier2014-05-24 11:50:05 -0400
commit3b1c4207001a24c047f73fe882ae16a1ff05cdc4 (patch)
tree59182022acab08af836891bca86122c4fdd77842 /src
parent486eebacf33c4d0835279cdb009bc02c2d687e6c (diff)
downloademacs-3b1c4207001a24c047f73fe882ae16a1ff05cdc4.tar.gz
emacs-3b1c4207001a24c047f73fe882ae16a1ff05cdc4.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/xdisp.c31
2 files changed, 33 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 256eeeaa4b3..c95e0c9de15 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12014-05-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * xdisp.c: Bind inhibit-quit during pre-redisplay-function.
4 (safe__call, safe__call1, safe__eval): New functions.
5 (safe_call): Use it.
6 (prepare_menu_bars): Use it for pre-redisplay-function (bug#17577).
7 (display_mode_element): Same for `:eval'.
8
12014-05-22 Paul Eggert <eggert@cs.ucla.edu> 92014-05-22 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 Fix port to 32-bit AIX (Bug#17540). 11 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)
2591 following. Return the result, or nil if something went 2591 following. Return the result, or nil if something went
2592 wrong. Prevent redisplay during the evaluation. */ 2592 wrong. Prevent redisplay during the evaluation. */
2593 2593
2594Lisp_Object 2594static Lisp_Object
2595safe_call (ptrdiff_t nargs, Lisp_Object func, ...) 2595safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, ...)
2596{ 2596{
2597 Lisp_Object val; 2597 Lisp_Object val;
2598 2598
@@ -2615,6 +2615,8 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2615 GCPRO1 (args[0]); 2615 GCPRO1 (args[0]);
2616 gcpro1.nvars = nargs; 2616 gcpro1.nvars = nargs;
2617 specbind (Qinhibit_redisplay, Qt); 2617 specbind (Qinhibit_redisplay, Qt);
2618 if (inhibit_quit)
2619 specbind (Qinhibit_quit, Qt);
2618 /* Use Qt to ensure debugger does not run, 2620 /* Use Qt to ensure debugger does not run,
2619 so there is no possibility of wanting to redisplay. */ 2621 so there is no possibility of wanting to redisplay. */
2620 val = internal_condition_case_n (Ffuncall, nargs, args, Qt, 2622 val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
@@ -2626,6 +2628,11 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2626 return val; 2628 return val;
2627} 2629}
2628 2630
2631Lisp_Object
2632safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2633{
2634 return safe__call (false, nargs, func);
2635}
2629 2636
2630/* Call function FN with one argument ARG. 2637/* Call function FN with one argument ARG.
2631 Return the result, or nil if something went wrong. */ 2638 Return the result, or nil if something went wrong. */
@@ -2633,7 +2640,13 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2633Lisp_Object 2640Lisp_Object
2634safe_call1 (Lisp_Object fn, Lisp_Object arg) 2641safe_call1 (Lisp_Object fn, Lisp_Object arg)
2635{ 2642{
2636 return safe_call (2, fn, arg); 2643 return safe__call (false, 2, fn, arg);
2644}
2645
2646Lisp_Object
2647safe__call1 (bool inhibit_quit, Lisp_Object fn, Lisp_Object arg)
2648{
2649 return safe__call (inhibit_quit, 2, fn, arg);
2637} 2650}
2638 2651
2639static Lisp_Object Qeval; 2652static Lisp_Object Qeval;
@@ -2641,7 +2654,13 @@ static Lisp_Object Qeval;
2641Lisp_Object 2654Lisp_Object
2642safe_eval (Lisp_Object sexpr) 2655safe_eval (Lisp_Object sexpr)
2643{ 2656{
2644 return safe_call1 (Qeval, sexpr); 2657 return safe__call1 (false, Qeval, sexpr);
2658}
2659
2660Lisp_Object
2661safe__eval (bool inhibit_quit, Lisp_Object sexpr)
2662{
2663 return safe__call1 (inhibit_quit, Qeval, sexpr);
2645} 2664}
2646 2665
2647/* Call function FN with two arguments ARG1 and ARG2. 2666/* Call function FN with two arguments ARG1 and ARG2.
@@ -11549,7 +11568,7 @@ prepare_menu_bars (void)
11549 } 11568 }
11550 } 11569 }
11551 } 11570 }
11552 safe_call1 (Vpre_redisplay_function, windows); 11571 safe__call1 (true, Vpre_redisplay_function, windows);
11553 } 11572 }
11554 11573
11555 /* Update all frame titles based on their buffer names, etc. We do 11574 /* 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,
21863 if (CONSP (XCDR (elt))) 21882 if (CONSP (XCDR (elt)))
21864 { 21883 {
21865 Lisp_Object spec; 21884 Lisp_Object spec;
21866 spec = safe_eval (XCAR (XCDR (elt))); 21885 spec = safe__eval (true, XCAR (XCDR (elt)));
21867 n += display_mode_element (it, depth, field_width - n, 21886 n += display_mode_element (it, depth, field_width - n,
21868 precision - n, spec, props, 21887 precision - n, spec, props,
21869 risky); 21888 risky);