Ever since upgrading to emacs 24.4.1, when I set something as 'done' from the agenda, I frequently get the error:

Error in post-command-hook (org-add-log-note): (error "Variable binding depth exceeds   max-specpdl-size")

When this happens, the Agenda does not reappear and the org buffer being modified continues being show.

What is the best way to debug this?

  • M-x toggle-debug-on-error
    – Malabarba
    Commented Oct 24, 2014 at 22:12
  • It's on, but nothing has shown up. Commented Oct 24, 2014 at 22:20
  • Did you reproduce the error after running that command?
    – Malabarba
    Commented Oct 24, 2014 at 22:23
  • Yes. As I said, nothing happens. Commented Oct 24, 2014 at 23:45

1 Answer 1


debug-on-error, and more generally the debugger, are not available for errors raised from post-command-hook (for example, to prevent runaway recursion).

What you can do is what programmers have done from Day One: print information. But before you do that, bisect the list of functions that you have on post-command-hook, narrowing the problem down to determine the function (probably only one) that is causing the problem.

Then place calls to function message at various places in that function's code (e.g. use a copy of the function definition). Use message to print info about the code path executed, and also various state information - e.g., the value of relevant variables.

Open buffer *Messages* in a separate frame (C-x 5 b), and place the cursor at the end of the buffer, so you can see what's going on. Then do what you do normally, which provokes the problem. You should be able to see, in *Messages*, what is going on.

Pretty much anything the debugger could tell you you can see using this method, anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.