[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Different behaviour while debugging?

From: Drew Adams
Subject: RE: Different behaviour while debugging?
Date: Wed, 20 Feb 2013 07:08:29 -0800

> I have the very strange case that a program - in some special 
> situation
> - does not work as expected, but when I instrument the relevant
> function(s) for edebug and single-step through them, everythings works
> as expected and the output is fine. 
> There are no errors involved, so 'toggle-debug-on-error does not help.
> Its just that the program should put a buffer temporarily into a given
> major-mode and uncomment some comment-lines with 'uncomment-region'
> before turning-on Org-mode. 

Yes, it can happen that using the debugger gives you different behavior,
especially when there are changes of selected window or current buffer or frame
focus, or there is interaction with a timer or some events.  It's a case of the
observer affecting the observation, in some sense.

The debugger is pretty useful most of the time, but there are cases where you
need to find another solution.  Typically you can insert calls to `message' in
the code to be debugged, perhaps with accompanying `sleep-for' or `sit-for'

Before you do that, however, try the normal Emacs debugger, `debug', instead of
`edebug'.  You can use `M-x debug-on-entry' to do that.  Or you can insert calls
`(debug)' in the code itself.  See the manual or `C-h f debug' for more info
about using `debug'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]