aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarek Czekalski2013-11-05 15:12:39 -0500
committerStefan Monnier2013-11-05 15:12:39 -0500
commit2ea0d614991d2ca8617c898c24a1ddd6e0d09f68 (patch)
treed36ef794d255d055b624bed30793b529b2f21b23 /src
parentc67c5132e9082b551350973e4b1c28bb193f9b70 (diff)
downloademacs-2ea0d614991d2ca8617c898c24a1ddd6e0d09f68.tar.gz
emacs-2ea0d614991d2ca8617c898c24a1ddd6e0d09f68.zip
* src/keyboard.c (Fdefault_error_output): New function, extracted from
cmd_error_internal. (syms_of_keyboard): Use it for Vcommand_error_function.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/keyboard.c40
2 files changed, 35 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e23af26f543..04eabcb26db 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,10 +1,14 @@
12013-11-05 Jarek Czekalski <jarekczek@poczta.onet.pl> (tiny change)
2
3 * keyboard.c: new function default-error-output which becomes
4 a default value for command-error-function.
5
12013-11-05 Stefan Monnier <monnier@iro.umontreal.ca> 62013-11-05 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * eval.c (handlerlist_sentinel): New variable (bug#15802). 8 * eval.c (handlerlist_sentinel): New variable (bug#15802).
4 (init_eval): Use it to ensure handlerlist is non-NULL. 9 (init_eval): Use it to ensure handlerlist is non-NULL.
5 (unwind_to_catch): Make sure we never set handlerlist to NULL. 10 (unwind_to_catch): Make sure we never set handlerlist to NULL.
6 (Fsignal): Adjust NULLness test of handlerlist. 11 (Fsignal): Adjust NULLness test of handlerlist.
7
8 * lisp.h (PUSH_HANDLER): Assume handlerlist is non-NULL. 12 * lisp.h (PUSH_HANDLER): Assume handlerlist is non-NULL.
9 13
102013-11-05 Eli Zaretskii <eliz@gnu.org> 142013-11-05 Eli Zaretskii <eliz@gnu.org>
diff --git a/src/keyboard.c b/src/keyboard.c
index c157eb19a28..dbc0bccd232 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -241,6 +241,8 @@ Lisp_Object Qrecompute_lucid_menubar, Qactivate_menubar_hook;
241 241
242static Lisp_Object Qecho_area_clear_hook; 242static Lisp_Object Qecho_area_clear_hook;
243 243
244static Lisp_Object Qdefault_error_output;
245
244/* Hooks to run before and after each command. */ 246/* Hooks to run before and after each command. */
245static Lisp_Object Qpre_command_hook; 247static Lisp_Object Qpre_command_hook;
246static Lisp_Object Qpost_command_hook; 248static Lisp_Object Qpost_command_hook;
@@ -1064,8 +1066,6 @@ cmd_error (Lisp_Object data)
1064void 1066void
1065cmd_error_internal (Lisp_Object data, const char *context) 1067cmd_error_internal (Lisp_Object data, const char *context)
1066{ 1068{
1067 struct frame *sf = SELECTED_FRAME ();
1068
1069 /* The immediate context is not interesting for Quits, 1069 /* The immediate context is not interesting for Quits,
1070 since they are asynchronous. */ 1070 since they are asynchronous. */
1071 if (EQ (XCAR (data), Qquit)) 1071 if (EQ (XCAR (data), Qquit))
@@ -1074,14 +1074,31 @@ cmd_error_internal (Lisp_Object data, const char *context)
1074 Vquit_flag = Qnil; 1074 Vquit_flag = Qnil;
1075 Vinhibit_quit = Qt; 1075 Vinhibit_quit = Qt;
1076 1076
1077 /* Use user's specified output function if any. */ 1077 /* Use user's specified output function,
1078 initially it is our Fdefault_error_output. */
1078 if (!NILP (Vcommand_error_function)) 1079 if (!NILP (Vcommand_error_function))
1079 call3 (Vcommand_error_function, data, 1080 call3 (Vcommand_error_function, data,
1080 context ? build_string (context) : empty_unibyte_string, 1081 context ? build_string (context) : empty_unibyte_string,
1081 Vsignaling_function); 1082 Vsignaling_function);
1083
1084 Vsignaling_function = Qnil;
1085}
1086
1087DEFUN ("default-error-output", Fdefault_error_output,
1088 Sdefault_error_output, 3, 3, 0,
1089 doc: /* Produce default output for the error message,
1090into the messages buffer and the echo area. */)
1091 (Lisp_Object data, Lisp_Object context, Lisp_Object signal)
1092{
1093 struct frame *sf = SELECTED_FRAME ();
1094 const char *sz_context;
1095
1096 CHECK_STRING(context);
1097 sz_context = XSTRING(context)->data;
1098
1082 /* If the window system or terminal frame hasn't been initialized 1099 /* If the window system or terminal frame hasn't been initialized
1083 yet, or we're not interactive, write the message to stderr and exit. */ 1100 yet, or we're not interactive, write the message to stderr and exit. */
1084 else if (!sf->glyphs_initialized_p 1101 if (!sf->glyphs_initialized_p
1085 /* The initial frame is a special non-displaying frame. It 1102 /* The initial frame is a special non-displaying frame. It
1086 will be current in daemon mode when there are no frames 1103 will be current in daemon mode when there are no frames
1087 to display, and in non-daemon mode before the real frame 1104 to display, and in non-daemon mode before the real frame
@@ -1096,7 +1113,7 @@ cmd_error_internal (Lisp_Object data, const char *context)
1096 || noninteractive) 1113 || noninteractive)
1097 { 1114 {
1098 print_error_message (data, Qexternal_debugging_output, 1115 print_error_message (data, Qexternal_debugging_output,
1099 context, Vsignaling_function); 1116 sz_context, signal);
1100 Fterpri (Qexternal_debugging_output); 1117 Fterpri (Qexternal_debugging_output);
1101 Fkill_emacs (make_number (-1)); 1118 Fkill_emacs (make_number (-1));
1102 } 1119 }
@@ -1107,10 +1124,8 @@ cmd_error_internal (Lisp_Object data, const char *context)
1107 message_log_maybe_newline (); 1124 message_log_maybe_newline ();
1108 bitch_at_user (); 1125 bitch_at_user ();
1109 1126
1110 print_error_message (data, Qt, context, Vsignaling_function); 1127 print_error_message (data, Qt, sz_context, signal);
1111 } 1128 }
1112
1113 Vsignaling_function = Qnil;
1114} 1129}
1115 1130
1116static Lisp_Object command_loop_2 (Lisp_Object); 1131static Lisp_Object command_loop_2 (Lisp_Object);
@@ -11108,6 +11123,7 @@ syms_of_keyboard (void)
11108 defsubr (&Sabort_recursive_edit); 11123 defsubr (&Sabort_recursive_edit);
11109 defsubr (&Sexit_recursive_edit); 11124 defsubr (&Sexit_recursive_edit);
11110 defsubr (&Srecursion_depth); 11125 defsubr (&Srecursion_depth);
11126 defsubr (&Sdefault_error_output);
11111 defsubr (&Stop_level); 11127 defsubr (&Stop_level);
11112 defsubr (&Sdiscard_input); 11128 defsubr (&Sdiscard_input);
11113 defsubr (&Sopen_dribble_file); 11129 defsubr (&Sopen_dribble_file);
@@ -11586,14 +11602,18 @@ The value of that variable is passed to `quit-flag' and later causes a
11586peculiar kind of quitting. */); 11602peculiar kind of quitting. */);
11587 Vthrow_on_input = Qnil; 11603 Vthrow_on_input = Qnil;
11588 11604
11605 DEFSYM (Qdefault_error_output, "default-error-output");
11589 DEFVAR_LISP ("command-error-function", Vcommand_error_function, 11606 DEFVAR_LISP ("command-error-function", Vcommand_error_function,
11590 doc: /* If non-nil, function to output error messages. 11607 doc: /* If non-nil, function to output error messages.
11591The arguments are the error data, a list of the form 11608The arguments are the error data, a list of the form
11592 (SIGNALED-CONDITIONS . SIGNAL-DATA) 11609 (SIGNALED-CONDITIONS . SIGNAL-DATA)
11593such as just as `condition-case' would bind its variable to, 11610such as just as `condition-case' would bind its variable to,
11594the context (a string which normally goes at the start of the message), 11611the context (a string which normally goes at the start of the message),
11595and the Lisp function within which the error was signaled. */); 11612and the Lisp function within which the error was signaled.
11596 Vcommand_error_function = Qnil; 11613
11614This variable is initialized with Emacs default error output function.
11615It is suggested that user functions are added using add-function. */);
11616 Vcommand_error_function = Qdefault_error_output;
11597 11617
11598 DEFVAR_LISP ("enable-disabled-menus-and-buttons", 11618 DEFVAR_LISP ("enable-disabled-menus-and-buttons",
11599 Venable_disabled_menus_and_buttons, 11619 Venable_disabled_menus_and_buttons,