Tuesday, May 3, 2011

breaking a running emacs lisp program

I'm having a problem with an emacs lisp package that I pulled down from the ubuntu distribution. The package is JDEE, and it complains of 'Args out of range: "63", 0, 4' in the mini buffer and the Messages buffer whenever I open a file. This bug appears to have been reported last September but no action has been taken. I'm not an emacs newbie, having written some elisp code myself, but I've never attempted to debug anything like this. I would like to stop the file load in a debugger when this error happens to at least get an idea of where the problem is coming from. I've read section 18.1.1 of the elisp manual on "Entering the debugger on error" but trying to load the file after playing with various combinations of values for debug-on-error, debug-ignored-errors, and debug-on-signal appears to have no effect. Has anybody got any suggestions for my next step?

From stackoverflow
  • If debug-on-error isn't working, I'd start with the source itself. Find the keybinding/event that is causing the problem, and locate the function.

    C-h k <keystrokes>
    M-x find-function <function-name-from-above>
    

    Now, once you are at the source

    M-x edebug-defun
    

    And the next time you hit the key, you should be able to step through the program. At that point, you can see which portion causes an error - and drill down that way.

    You can also try setting the variable 'stack-trace-on-error to see if you can find the culprit (though 'debug-on-error usually works for me, not sure why it doesn't for you).

    As a last resort (if edebug-defun doesn't work), you can redefine the routine with a call to (debug) in it, sort of does the same.

  • I suppose JDEE is somehow inhibiting debug-on-error. Perhaps grep through its files for the error message "Args out of range". While debugging, make sure to load the uncompiled .el files, not the byte-compiled .elc files (you will notice it in the debugger if you are running byte-compiled code) by entering commands like (load "foo.el") instead of (load "foo").

0 comments:

Post a Comment