# Figuring out what plugin is messing with my input

This is a more general question so I would like to know how to actually debug something like this. Suppose that I have some plugin that does section completion as code is being written. For example this can be bracket completion - I type { and } appears as well.

How can I actually find out which lisp function is making these modifications to the buffer? Is there some way to list all hooks being called during text entry?

I would start with C-hk{ to see what command { is bound to in the buffer in question, as it might well be bound to some hypothetical insert-both-{-and-} command.

If the behaviour is triggered by keys which are bound to self-insert-command then the hook you are looking for is rather likely to be C-hv post-self-insert-hook

post-command-hook is a more generic possibility, and then there are C-hig (elisp)Change Hooks which are again very general (and trickier to use).

The Emacs parlance for functionality whereby additional things happen automatically when you insert certain characters is "electric"; so an alternative in a situation like this one would be:

M-x apropos-variable RET electric RET

or perhaps:

M-x apropos-command RET electric.*mode RET

In your case, I would suspect you have enabled either electric-pair-mode (which is a global minor mode) or electric-pair-local-mode (which is the buffer-local equivalent).

See also C-hig (emacs)Matching