How to debug (say) python-mode.el?

Asked by Richard Stanton

Having reported a lot of bugs, it doesn't seem like a bad idea for me to learn some elisp and actually help debug the code myself. The language itself doesn't seem too hard but, from a practical perspective, do people have recommendations for how to develop/debug elisp code? For example, if in python-mode I wanted to track down how the temp file name/directory were being set, what would be the best way to trace through the execution of the code to see what it's doing?

Question information

Language:
English Edit question
Status:
Answered
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andreas Roehler (a-roehler) said :
#1

set debug-on-error to non-nil
if you want to inspect execution, go to function definition and do M-x edebug-defun

Get this:
http://repo.or.cz/w/elbb.git/blob/HEAD:/code/Go-to-Emacs-Lisp-Definition.el

Revision history for this message
Richard Stanton (a-stanton) said :
#2

Thanks, Andreas. It would be immensely helpful (to someone who's done a lot of programming, and in particular is very used to debugging using gdb under Emacs) if you could go step by step through a typical (if simple/short) debugging session using edebug, explaining your workflow, which particular commands are useful, etc. For example,

a. What functions do you use in Go-To-Emacs-Lisp-Definition.el, and for what?

b. I tried tracing through a function in edebug. I wanted to jump into a function referred to on the current line, so I pressed "i", but apparently I pressed it at the wrong point in the execution, and got an error message. No problem, except that there seemed to be no way to get back to my debugging session! What was I missing?

Thanks!

Revision history for this message
Andreas Roehler (a-roehler) said :
#3

Hi Richard,

will come back to this when, lp:957690 --python-mode is sluggish on some files-- is fixed.
BTW feel free to mail me some of your coding meanwhile - just out of curiosity.

Cheers,

Andreas

Can you help with this problem?

Provide an answer of your own, or ask Richard Stanton for more information if necessary.

To post a message you must log in.