GNU bug report logs - #13815
Wrong mode for files with awkward shebang lines

Previous Next

Package: emacs;

Reported by: Andrew Pennebaker <andrew.pennebaker <at> gmail.com>

Date: Tue, 26 Feb 2013 01:26:01 UTC

Severity: wishlist

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andrew Pennebaker <andrew.pennebaker <at> gmail.com>
Cc: 13815 <at> debbugs.gnu.org
Subject: bug#13815: Wrong mode for files with awkward shebang lines
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




This bug report was last modified 3 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.