I'm developing a major mode for Emacs. Is there any way that I can set a break point in the source code when fontification happens, for example?
Find the Lisp source of the function you'd like to step through, and type M-x edebug-defun
there. Then, whenever that function is executed, you'll automatically be placed into Edebug, where you can step through it if you wish.
Fontification functions can be a bit tricky though, as they can be invoked at odd times. You can use the message
function to write messages into the *Messages*
buffer. Another trick is to turn off Font Lock (so your function doesn't get invoked automatically), then prep the function you're debugging with edebug-defun
and invoke it manually. (Note that you can use M-:
(a.k.a. eval-expression
) to invoke a non-interactive function.)
The manual for debugging elisp can be found here.
You can used edebug
as mentioned, there's also M-x debug-on-entry and you can set (setq debug-on-quit t)
. Check out all the options in the link, it all depends on how you want to skin the cat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With