aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2006-07-17 21:00:58 +0000
committerRichard M. Stallman2006-07-17 21:00:58 +0000
commit04d8c47ded95adc93d1bc2082c9f8a39a9d4bb86 (patch)
treec80d2f3fcb7b0f3c5a756754e03640bed6e4026a /src
parentb9e590fc9573a874e26203ddad566325b97dc2c3 (diff)
downloademacs-04d8c47ded95adc93d1bc2082c9f8a39a9d4bb86.tar.gz
emacs-04d8c47ded95adc93d1bc2082c9f8a39a9d4bb86.zip
(Vcommand_error_function): New variable.
(syms_of_keyboard): Defvar it. (cmd_error_internal): Simplify, and handle Vcommand_error_function.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c69
1 files changed, 38 insertions, 31 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 6bd9d754c60..4cbccb0b1a2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -242,6 +242,9 @@ static int inhibit_local_menu_bar_menus;
242/* Nonzero means C-g should cause immediate error-signal. */ 242/* Nonzero means C-g should cause immediate error-signal. */
243int immediate_quit; 243int immediate_quit;
244 244
245/* The user's hook function for outputting an error message. */
246Lisp_Object Vcommand_error_function;
247
245/* The user's ERASE setting. */ 248/* The user's ERASE setting. */
246Lisp_Object Vtty_erase_char; 249Lisp_Object Vtty_erase_char;
247 250
@@ -1230,52 +1233,47 @@ cmd_error_internal (data, context)
1230 Lisp_Object data; 1233 Lisp_Object data;
1231 char *context; 1234 char *context;
1232{ 1235{
1233 Lisp_Object stream;
1234 int kill_emacs_p = 0;
1235 struct frame *sf = SELECTED_FRAME (); 1236 struct frame *sf = SELECTED_FRAME ();
1236 1237
1238 /* The immediate context is not interesting for Quits,
1239 since they are asyncronous. */
1240 if (EQ (XCAR (data), Qquit))
1241 Vsignaling_function = Qnil;
1242
1237 Vquit_flag = Qnil; 1243 Vquit_flag = Qnil;
1238 Vinhibit_quit = Qt; 1244 Vinhibit_quit = Qt;
1239 clear_message (1, 0);
1240 1245
1246 /* Use user's specified output function if any. */
1247 if (!NILP (Vcommand_error_function))
1248 call3 (Vcommand_error_function, data,
1249 build_string (context ? context : ""),
1250 Vsignaling_function);
1241 /* If the window system or terminal frame hasn't been initialized 1251 /* If the window system or terminal frame hasn't been initialized
1242 yet, or we're not interactive, it's best to dump this message out 1252 yet, or we're not interactive, write the message to stderr and exit. */
1243 to stderr and exit. */ 1253 else if (!sf->glyphs_initialized_p
1244 if (!sf->glyphs_initialized_p 1254 /* This is the case of the frame dumped with Emacs, when we're
1245 /* This is the case of the frame dumped with Emacs, when we're 1255 running under a window system. */
1246 running under a window system. */ 1256 || (!NILP (Vwindow_system)
1247 || (!NILP (Vwindow_system) 1257 && !inhibit_window_system
1248 && !inhibit_window_system 1258 && FRAME_TERMCAP_P (sf))
1249 && FRAME_TERMCAP_P (sf)) 1259 || noninteractive)
1250 || noninteractive) 1260 {
1251 { 1261 print_error_message (data, Qexternal_debugging_output,
1252 stream = Qexternal_debugging_output; 1262 context, Vsignaling_function);
1253 kill_emacs_p = 1; 1263 Fterpri (Qexternal_debugging_output);
1264 Fkill_emacs (make_number (-1));
1254 } 1265 }
1255 else 1266 else
1256 { 1267 {
1268 clear_message (1, 0);
1257 Fdiscard_input (); 1269 Fdiscard_input ();
1258 message_log_maybe_newline (); 1270 message_log_maybe_newline ();
1259 bitch_at_user (); 1271 bitch_at_user ();
1260 stream = Qt;
1261 }
1262
1263 /* The immediate context is not interesting for Quits,
1264 since they are asyncronous. */
1265 if (EQ (XCAR (data), Qquit))
1266 Vsignaling_function = Qnil;
1267 1272
1268 print_error_message (data, stream, context, Vsignaling_function); 1273 print_error_message (data, Qt, context, Vsignaling_function);
1274 }
1269 1275
1270 Vsignaling_function = Qnil; 1276 Vsignaling_function = Qnil;
1271
1272 /* If the window system or terminal frame hasn't been initialized
1273 yet, or we're in -batch mode, this error should cause Emacs to exit. */
1274 if (kill_emacs_p)
1275 {
1276 Fterpri (stream);
1277 Fkill_emacs (make_number (-1));
1278 }
1279} 1277}
1280 1278
1281Lisp_Object command_loop_1 (); 1279Lisp_Object command_loop_1 ();
@@ -11484,6 +11482,15 @@ The value of that variable is passed to `quit-flag' and later causes a
11484peculiar kind of quitting. */); 11482peculiar kind of quitting. */);
11485 Vthrow_on_input = Qnil; 11483 Vthrow_on_input = Qnil;
11486 11484
11485 DEFVAR_LISP ("command-error-function", &Vcommand_error_function,
11486 doc: /* If non-nil, function to output error messages.
11487The arguments are the error data, a list of the form
11488 (SIGNALED-CONDITIONS . SIGNAL-DATA)
11489such as just as `condition-case' would bind its variable to,
11490the context (a string which normally goes at the start of the message),
11491and the Lisp function within which the error was signaled. */);
11492 Vcommand_error_function = Qnil;
11493
11487 DEFVAR_LISP ("enable-disabled-menus-and-buttons", 11494 DEFVAR_LISP ("enable-disabled-menus-and-buttons",
11488 &Venable_disabled_menus_and_buttons, 11495 &Venable_disabled_menus_and_buttons,
11489 doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar. 11496 doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar.