Add missing parantheses
Reorder the shell code
Add auto-modes macro

Handle auto-mode-alist in one single place.
Remove unnecessary interactive wrap