aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Ingebrigtsen2012-09-04 23:21:00 +0200
committerLars Ingebrigtsen2012-09-04 23:21:00 +0200
commit7f7e0167cf664f2d66ac3fa8a7301e05f09883d2 (patch)
treeef9d2dade54e23c6c37e6bd655aae118cdbde261 /src
parentcf29dd84d205e1c78fed5d1ea0006a382658598c (diff)
downloademacs-7f7e0167cf664f2d66ac3fa8a7301e05f09883d2.tar.gz
emacs-7f7e0167cf664f2d66ac3fa8a7301e05f09883d2.zip
Implement `debug-on-message'.
This allows tracking down what piece of code is outputting stuff in the echo area. * eval.c (call_debugger): Make the function non-static so that we can call it from set_message. * xdisp.c (set_message): Implement the new variable `debug-on-message'. (syms_of_xdisp): Defvar it and `inhibit-debug-on-message'.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/eval.c2
-rw-r--r--src/lisp.h1
-rw-r--r--src/xdisp.c22
4 files changed, 31 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ea3b3a92e01..d7a263df229 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-09-04 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * eval.c (call_debugger): Make the function non-static so that we
4 can call it from set_message.
5
6 * xdisp.c (set_message): Implement the new variable `debug-on-message'.
7 (syms_of_xdisp): Defvar it and `inhibit-debug-on-message'.
8
12012-09-04 Paul Eggert <eggert@cs.ucla.edu> 92012-09-04 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 Give more-useful info on a fatal error (Bug#12328). 11 Give more-useful info on a fatal error (Bug#12328).
diff --git a/src/eval.c b/src/eval.c
index 1015b013a26..4f0d6c69a51 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -191,7 +191,7 @@ restore_stack_limits (Lisp_Object data)
191 191
192/* Call the Lisp debugger, giving it argument ARG. */ 192/* Call the Lisp debugger, giving it argument ARG. */
193 193
194static Lisp_Object 194Lisp_Object
195call_debugger (Lisp_Object arg) 195call_debugger (Lisp_Object arg)
196{ 196{
197 bool debug_while_redisplaying; 197 bool debug_while_redisplaying;
diff --git a/src/lisp.h b/src/lisp.h
index 9ee9cd74b56..78c418f3051 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3076,6 +3076,7 @@ extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
3076extern _Noreturn void verror (const char *, va_list) 3076extern _Noreturn void verror (const char *, va_list)
3077 ATTRIBUTE_FORMAT_PRINTF (1, 0); 3077 ATTRIBUTE_FORMAT_PRINTF (1, 0);
3078extern Lisp_Object un_autoload (Lisp_Object); 3078extern Lisp_Object un_autoload (Lisp_Object);
3079extern Lisp_Object call_debugger (Lisp_Object arg);
3079extern void init_eval_once (void); 3080extern void init_eval_once (void);
3080extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...); 3081extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...);
3081extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); 3082extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
diff --git a/src/xdisp.c b/src/xdisp.c
index f543a96d6b3..90a8de0be27 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -364,6 +364,7 @@ static Lisp_Object Qslice;
364Lisp_Object Qcenter; 364Lisp_Object Qcenter;
365static Lisp_Object Qmargin, Qpointer; 365static Lisp_Object Qmargin, Qpointer;
366static Lisp_Object Qline_height; 366static Lisp_Object Qline_height;
367Lisp_Object Qinhibit_debug_on_message;
367 368
368/* These setters are used only in this file, so they can be private. */ 369/* These setters are used only in this file, so they can be private. */
369static inline void 370static inline void
@@ -10571,7 +10572,6 @@ truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4
10571 return 0; 10572 return 0;
10572} 10573}
10573 10574
10574
10575/* Set the current message to a substring of S or STRING. 10575/* Set the current message to a substring of S or STRING.
10576 10576
10577 If STRING is a Lisp string, set the message to the first NBYTES 10577 If STRING is a Lisp string, set the message to the first NBYTES
@@ -10590,6 +10590,8 @@ static void
10590set_message (const char *s, Lisp_Object string, 10590set_message (const char *s, Lisp_Object string,
10591 ptrdiff_t nbytes, int multibyte_p) 10591 ptrdiff_t nbytes, int multibyte_p)
10592{ 10592{
10593 ptrdiff_t count = SPECPDL_INDEX ();
10594
10593 message_enable_multibyte 10595 message_enable_multibyte
10594 = ((s && multibyte_p) 10596 = ((s && multibyte_p)
10595 || (STRINGP (string) && STRING_MULTIBYTE (string))); 10597 || (STRINGP (string) && STRING_MULTIBYTE (string)));
@@ -10598,6 +10600,15 @@ set_message (const char *s, Lisp_Object string,
10598 (intptr_t) s, string, nbytes, multibyte_p); 10600 (intptr_t) s, string, nbytes, multibyte_p);
10599 message_buf_print = 0; 10601 message_buf_print = 0;
10600 help_echo_showing_p = 0; 10602 help_echo_showing_p = 0;
10603
10604 if (NILP (Vinhibit_debug_on_message) &&
10605 STRINGP (Vdebug_on_message) &&
10606 fast_string_match (Vdebug_on_message, string) >= 0) {
10607 specbind (Qinhibit_debug_on_message, Qt);
10608 call_debugger (Fcons (Qerror, Fcons (string, Qnil)));
10609 }
10610
10611 unbind_to (count, Qnil);
10601} 10612}
10602 10613
10603 10614
@@ -29299,6 +29310,15 @@ Its value should be an ASCII acronym string, `hex-code', `empty-box', or
29299 Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); 29310 Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil);
29300 Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), 29311 Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0),
29301 Qempty_box); 29312 Qempty_box);
29313
29314 DEFVAR_LISP ("debug-on-message", Vdebug_on_message,
29315 doc: /* If non-nil, debug if a message matching this regexp is displayed. */);
29316 Vdebug_on_message = Qnil;
29317
29318 DEFVAR_LISP ("inhibit-debug-on-message", Vinhibit_debug_on_message,
29319 doc: /* If non-nil, inhibit `debug-on-message' from entering the debugger. */);
29320 Vinhibit_debug_on_message = Qnil;
29321 DEFSYM(Qinhibit_debug_on_message, "inhibit-debug-on-message");
29302} 29322}
29303 29323
29304 29324