On debugging Elisp

Was playing around with Elixir, installed elixir-mode, but indentation wasn’t working.

About to give up, but took it as an opportunity to learn how to debug Elisp, and … whoa, it was effortless.

(debug-on-entry #'elixir-indent-line)

Hit Tab, and bang, right in the debugger, which is well-documented. Hit d to continue execution, see every expression being evaluated.

Decided to add some “print statements” (yes, right within the ~/.emacs.d/elpa/elixir-mode-1.0.0/ sources!), which in this case was something like

(message "Debug: cur-indent computed = `%s', current-indentation = `%s'" cur-indent (current-indentation))

Had to iterate a few times, but it was trivially (load-file ...) and hit Tab, watch the *Messages* buffer, repeat.

Turned out to be a typo, one of the calls to (setq not-indented ... was mis-spelled as (setq not-idented ...

Great, I thought, except … I found I was using an older version of the package, so the right fix here turned out to be … uninstall older version of elixir-mode, install the new one, get on with life. But heh, I still feel like I “leveled up” in my Emacs use today 😀

P.S. the original error is preserved in this marmalade mirror.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s