diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2022-08-15 02:22:59 +0300 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2022-08-15 02:22:59 +0300 |
commit | ee3a674c7c9e39fe7ff296ce1f9830fc45520de8 (patch) | |
tree | e8ba1e7be54314f208454e80e3d31044c913f3eb /doc/lispref/debugging.texi | |
parent | fe0e53d963899a16e0dd1bbc1ba10a6b59f7989e (diff) | |
parent | 0a8e88fd83db5398d36064a7f87cff5b57da7284 (diff) | |
download | emacs-scratch/font_lock_large_files.tar.gz |
Merge branch 'master' into scratch/font_lock_large_filesscratch/font_lock_large_files
Diffstat (limited to 'doc/lispref/debugging.texi')
-rw-r--r-- | doc/lispref/debugging.texi | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 058c9319544..9ae40949d1e 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -77,6 +77,7 @@ debugger recursively. @xref{Recursive Editing}. @menu * Error Debugging:: Entering the debugger when an error happens. +* Debugging Redisplay:: Getting backtraces from redisplay errors. * Infinite Loops:: Stopping and debugging a program that doesn't exit. * Function Debugging:: Entering it when a certain function is called. * Variable Debugging:: Entering it when a variable is modified. @@ -105,6 +106,10 @@ debugger, set the variable @code{debug-on-error} to non-@code{nil}. (The command @code{toggle-debug-on-error} provides an easy way to do this.) +Note that, for technical reasons, you cannot use the facilities +defined in this subsection to debug errors in Lisp that the redisplay +code has invoked. @xref{Debugging Redisplay}, for help with these. + @defopt debug-on-error This variable determines whether the debugger is called when an error is signaled and not handled. If @code{debug-on-error} is @code{t}, @@ -213,6 +218,45 @@ file, use the option @samp{--debug-init}. This binds bypasses the @code{condition-case} which normally catches errors in the init file. +@node Debugging Redisplay +@subsection Debugging Redisplay Errors +@cindex redisplay errors +@cindex debugging redisplay errors + +When an error occurs in Lisp code which redisplay has invoked, Emacs's +usual debugging mechanisms are unusable, for technical reasons. This +subsection describes how to get a backtrace from such an error, which +should be helpful in debugging it. + +These directions apply to Lisp forms used, for example, in +@code{:eval} mode line constructs (@pxref{Mode Line Data}), and in all +hooks invoked from redisplay, such as: + +@itemize +@item +@code{fontification-functions} (@pxref{Auto Faces}). +@item +@code{window-scroll-functions} (@pxref{Window Hooks}). +@end itemize + +Note that if you have had an error in a hook function called from +redisplay, the error handling might have removed this function from +the hook. You will thus need to reinitialize that hook somehow, +perhaps with @code{add-hook}, to be able to replay the bug. + +To generate a backtrace in these circumstances, set the variable +@code{backtrace-on-redisplay-error} to non-@code{nil}. When the error +occurs, Emacs will dump the backtrace to the buffer +@file{*Redisplay-trace*}, but won't automatically display it in a +window. This is to avoid needlessly corrupting the redisplay you are +debugging. You will thus need to display the buffer yourself, with a +command such as @code{switch-to-buffer-other-frame} @key{C-x 5 b}. + +@defvar backtrace-on-redisplay-error +Set this variable to non-@code{nil} to enable the generation of a +backtrace when an error occurs in any Lisp called from redisplay. +@end defvar + @node Infinite Loops @subsection Debugging Infinite Loops @cindex infinite loops |