comparison src/xdisp.c @ 93369:ed10c3092847

* keyboard.c (pending_funcalls): New var. (timer_check): Run it. (syms_of_keyboard): Initialize it. * terminal.c (Qrun_hook_with_args, Qdelete_terminal_functions) (Vdelete_terminal_functions): New vars. (syms_of_terminal): Initialize them. (Fdelete_terminal): Run delete-terminal-functions. * xdisp.c (safe_eval): Rewrite. (safe_call2): New fun. * frame.c (Qdelete_frame_functions): New var. (syms_of_frame): Initialize it. (Fdelete_frame): Use it and use safe_call2 and pending_funcalls. * lisp.h (safe_call2, pending_funcalls): Declare.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 29 Mar 2008 01:46:10 +0000
parents 16142d1d9f33
children 38ab23c0b8ad
comparison
equal deleted inserted replaced
93368:411d7b7dfe32 93369:ed10c3092847
2314 2314
2315 2315
2316 /* Evaluate SEXPR and return the result, or nil if something went 2316 /* Evaluate SEXPR and return the result, or nil if something went
2317 wrong. Prevent redisplay during the evaluation. */ 2317 wrong. Prevent redisplay during the evaluation. */
2318 2318
2319 Lisp_Object
2320 safe_eval (sexpr)
2321 Lisp_Object sexpr;
2322 {
2323 Lisp_Object val;
2324
2325 if (inhibit_eval_during_redisplay)
2326 val = Qnil;
2327 else
2328 {
2329 int count = SPECPDL_INDEX ();
2330 struct gcpro gcpro1;
2331
2332 GCPRO1 (sexpr);
2333 specbind (Qinhibit_redisplay, Qt);
2334 /* Use Qt to ensure debugger does not run,
2335 so there is no possibility of wanting to redisplay. */
2336 val = internal_condition_case_1 (Feval, sexpr, Qt,
2337 safe_eval_handler);
2338 UNGCPRO;
2339 val = unbind_to (count, val);
2340 }
2341
2342 return val;
2343 }
2344
2345
2346 /* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1]. 2319 /* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1].
2347 Return the result, or nil if something went wrong. Prevent 2320 Return the result, or nil if something went wrong. Prevent
2348 redisplay during the evaluation. */ 2321 redisplay during the evaluation. */
2349 2322
2350 Lisp_Object 2323 Lisp_Object
2385 { 2358 {
2386 Lisp_Object args[2]; 2359 Lisp_Object args[2];
2387 args[0] = fn; 2360 args[0] = fn;
2388 args[1] = arg; 2361 args[1] = arg;
2389 return safe_call (2, args); 2362 return safe_call (2, args);
2363 }
2364
2365 static Lisp_Object Qeval;
2366
2367 Lisp_Object
2368 safe_eval (Lisp_Object sexpr)
2369 {
2370 return safe_call1 (Qeval, sexpr);
2371 }
2372
2373 /* Call function FN with one argument ARG.
2374 Return the result, or nil if something went wrong. */
2375
2376 Lisp_Object
2377 safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
2378 {
2379 Lisp_Object args[3];
2380 args[0] = fn;
2381 args[1] = arg1;
2382 args[2] = arg2;
2383 return safe_call (3, args);
2390 } 2384 }
2391 2385
2392 2386
2393 2387
2394 /*********************************************************************** 2388 /***********************************************************************
8632 Lisp_Object 8626 Lisp_Object
8633 current_message () 8627 current_message ()
8634 { 8628 {
8635 Lisp_Object msg; 8629 Lisp_Object msg;
8636 8630
8637 if (NILP (echo_area_buffer[0])) 8631 if (!BUFFERP (echo_area_buffer[0]))
8638 msg = Qnil; 8632 msg = Qnil;
8639 else 8633 else
8640 { 8634 {
8641 with_echo_area_buffer (0, 0, current_message_1, 8635 with_echo_area_buffer (0, 0, current_message_1,
8642 (EMACS_INT) &msg, Qnil, 0, 0); 8636 (EMACS_INT) &msg, Qnil, 0, 0);
24356 staticpro (&Qredisplay_end_trigger_functions); 24350 staticpro (&Qredisplay_end_trigger_functions);
24357 Qredisplay_end_trigger_functions = intern ("redisplay-end-trigger-functions"); 24351 Qredisplay_end_trigger_functions = intern ("redisplay-end-trigger-functions");
24358 24352
24359 staticpro (&Qinhibit_point_motion_hooks); 24353 staticpro (&Qinhibit_point_motion_hooks);
24360 Qinhibit_point_motion_hooks = intern ("inhibit-point-motion-hooks"); 24354 Qinhibit_point_motion_hooks = intern ("inhibit-point-motion-hooks");
24355
24356 Qeval = intern ("eval");
24357 staticpro (&Qeval);
24361 24358
24362 QCdata = intern (":data"); 24359 QCdata = intern (":data");
24363 staticpro (&QCdata); 24360 staticpro (&QCdata);
24364 Qdisplay = intern ("display"); 24361 Qdisplay = intern ("display");
24365 staticpro (&Qdisplay); 24362 staticpro (&Qdisplay);