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?
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.
M-x edebug-defun
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.)
message
*Messages*
edebug-defun
M-:
eval-expression
Elisp debugging guidance can be found here .
edebug, , M-x debug-on-entry, (setq debug-on-quit t). , , .
edebug
(setq debug-on-quit t)
, , . (message "here, foo=%d" foo) - . (, , *Messages*, , , .) trace-function .
(message "here, foo=%d" foo)
trace-function
emacs . . โโ
edebug debug. , M-x debug-on-entry THE-FUNCTION. debug , ( ).
debug
M-x debug-on-entry THE-FUNCTION
, , .. , , , font-lock-keywords.
font-lock-keywords
. , , , - (a) font-lock-keywords () (b) , , .
, " ": , (debug) , Lisp. .
(debug)
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.