Debug Emacs Lisp Native Mode

I am developing a core mode for Emacs. Is there a way that I can set a breakpoint in the source code when font deletion occurs, for example?

+5
source share
5 answers

Find the source of the Lisp function that you want to execute and enter M-x edebug-defunthere. Then, whenever this function is executed, you are automatically included in Edebug, where you can go through it if you want.

Functions of fonts can be a little complicated, as they can be called at odd times. You can use the function messageto write messages to the buffer *Messages*. Another trick is to disable Font Lock (so your function does not start automatically), and then prepare a function that you debug with edebug-defun, and call it manually. (Note that you can use M-:(aka eval-expression) to call a non-interactive function.)

+7
source

Elisp debugging guidance can be found here .

edebug, , M-x debug-on-entry, (setq debug-on-quit t). , , .

+4

, , . (message "here, foo=%d" foo) - . (, , *Messages*, , , .) trace-function .

emacs . . โ€‹โ€‹

+2

edebug debug. , M-x debug-on-entry THE-FUNCTION. debug , ( ).

, , .. , , , font-lock-keywords.

. , , , - (a) font-lock-keywords () (b) , , .

, " ": , (debug) , Lisp. .

+1

In another note, if you just want to quickly debug a lisp fragment, you might also want to use ielm mode, which works, for example, as an interactive python mode.

0
source

All Articles