bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#13815: Wrong mode for files with awkward shebang lines
Date: Mon, 25 Feb 2013 21:59:30 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]