I find allowing the shy regexp to match zero or more times (using a '*' instead of '?') solves not only the use case of including -S as an option, but also can support other options to env. I have this now in my init.el: (setq auto-mode-interpreter-regexp ;; support -S and other options to /bin/env. See ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64939 (purecopy "#![ \t]?\\([^ \t\n]*\ /bin/env[ \t]\\)?\\(?:-\\{1,2\\}[a-zA-Z1-9=]+[ \t]+\\)*\\([^ \t\n]+\\)")) Hooray? Why not patch lisp/files.el accordingly? ~ Malcolm Cook