Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug elisp?

Normally the easiest way to debug is using printf. What can I do to debug emacs-lisp? How can I print something to emacs editor from elisp? Or is there any way to debug elisp code?

For example, how can I check if the following code is run in .emacs file?

(load "auctex.el" nil t t) 
like image 575
prosseek Avatar asked Jul 15 '10 16:07

prosseek


People also ask

How do I debug Emacs?

You can enter the debugger when you call the function by calling debug-on-entry . Now, type d again, eight times, slowly. Each time you type d , Emacs will evaluate another expression in the function definition. By typing d , you were able to step through the function.

How do I exit debug in Emacs?

If the debugger was entered due to a C-g but you really want to quit, and not debug, use the q command.


1 Answers

The debugger (edebug) is pretty straight forward to use. Go to the definition of the function, and type M-x edebug-defun. The next time it is called, you'll be able to step through the code as with every other debugger. Type ? for the list of keybindings, or check out the documentation for edebug.

like image 191
Trey Jackson Avatar answered Oct 13 '22 18:10

Trey Jackson