Refactor dired-mode-hook to named function.