I am trying to debug a problem with the alert.el
package using edebug
. However, I am unable to step through the alert
function.
I expect the debugger to enter the function and allow me to step through. Instead, it terminates.
Here is what I'm doing:
- Open an Emacs instance opened with
emacs -Q
- Evaluate
(package-initialize)
- Call
C-u C-M-x
on(alert "Hello, world!")
At this point, I see an indicator in my fringe.
- Press
i
to step into the function call
On pressing i
, I quickly see "Go..." printed to the minibuffer and the fringe indicator disappears.
I am no longer debugging.
Checking C-h f alert
shows me that it is an autoloaded function. Might this be affecting my ability to step into it?
I have tried toggling (debug-on-error)
and stepping through with d
. However, I can't see the source code while stepping. Whenever I try to open another buffer with the source code in it, pressing d
in the *Backtrace*
closes the source code buffer. Is there a way to use (debug-on-error)
and see the source code while stepping through execution?
Any advice you have for debugging is welcome.
alert.el
withload-library
orrequire
.(require 'alert)
after Step 2. When I did that, I experienced the same behavior withedebug
. I did notice however that the help description changes to say"alert is an autoloaded Lisp closure..."
. Might that affectedebug
's behavior? I noticed this line in the documentation: "Most Emacs Lisp programs, however, should not interact directly with lexical environments in this way; only specialized programs like debuggers." gnu.org/software/emacs/manual/html_node/elisp/…C-u C-M-x
on the definition of the alert function, not on its use.alert
and there is a function calledalert
: go to line 1022 ofalert.el
to see it. It's the latter that you want to applyC-u C-M-x
to.(cl-defun alert ...
at line 1023. If you debug the cl-defun it works as expected.