Subject: Re: bug#13815: Wrong mode for files with awkward shebang lines

From: Stefan Monnier <[email-masked]>
Date: Mon, 25 Feb 2013 21:59:30 -0500

> This could be solved a variety of ways, but I think the simplest is to
> prioritize file extension over mimetype when a file extension is available.

IIRC no strict priority will do, because for some files, the content is
more important than the filename.

> We can't trust mimetypes for code that contains these awkward shebangs.

[ FWIW Emacs doesn't actually use "mimtypes" but its own set of
  file-contents-based rules.  Not that it matters to this discussion,
  really.  ]

I think the right way is to check both file content and file name and if
the type they specify do not agree, fall back on a disambiguation
function, which should include various ad-hoc rules, and may ultimately
prompt the user if none of the ad-hoc rules resolved the ambiguity.

But in your specific case, you might get away with tweaking
inhibit-local-variables-regexps.

        Stefan