Furthermore, I saw that you directly added hooks at the end; referring to the "Emacs Lisp Coding Conventions" at http://www.gnu.org/software/emacs/elisp/html_node/Coding-Conventions.html ,---- | Simply loading a package should not change Emacs's editing | behavior. Include a command or commands to enable and disable the | feature, or to invoke it. | | This convention is mandatory for any file that includes custom | definitions. If fixing such a file to follow this convention requires an | incompatible change, go ahead and make the incompatible change; don't | postpone it. `---- You can simply wrap a function around the adding/removal of the hooks: