Improve define-function inside add-hook and define-key.