Bugfix and re-write of my-overwrite-key-bindings-in-mode.

Fix bug in my-change-inside-pair function.
my-overwrite-key-bindings-in-mode was buggy when a buffer was
deleted and resurrected again. The check needed to be mode
specific not buffer specific. To make it work, I needed
the use of lexical variables and thus the setting lexical-binding
to t at the top of the buffer; which will only work for Emacs 24
and above.