First, some context:
I am in the process of debugging a strange interaction between smartparens and Org Speed Keys:
After editing an .org file for a while, specific speed keys for navigating the outline start to be treated as though they are modifying the buffer. For instance, if I press n on a heading after saving the file, the portion of the mode line that indicates whether the file has been modified or not changes from -- (unmodified) to ** (modified). No characters are inserted into the buffer though.
I tried to figure out what might be causing this problem by doing C-h k n right after opening the .org file and then again after the problematic behavior started. Turns out that initially, n is bound to org-self-insert-command, and gets rebound to sp--self-insert-command later on.
The problem is that I have no idea when the command bound to n changes. I also tried C-h l (view-lossage) a few times after the behavior changed but I couldn't detect any patterns that would give me a hint as to what might be triggering the change in behavior.
Question:
I think in order to solve this problem I need to pinpoint the exact command that is causing n to be rebound to sp--self-insert-command (if only to be able to automatically reset the binding).
So my question is: How can I detect when the command bound to n changes?