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?
--to**. – Drew Oct 08 '14 at 19:58sp--self-insert-command. After you find out just what's going on, consider filing a bug/enhancement report for smart-parens or org. – Drew Oct 08 '14 at 19:59smartparens-global-mode. – itsjeyd Oct 08 '14 at 20:10smartparenssource has only one function that binds keys tosp--self-insert-command. For now, I've advised this function tomessageme with info aboutlast-commandwhen it is called. Hopefully that will shed some more light on the matter :) – itsjeyd Oct 08 '14 at 21:00defadvice"define-keyto check its second parameter, and call the debugger if it's the one you are interested in? – angus Oct 09 '14 at 19:27