From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Andrew Pennebaker <andrew.pennebaker@gmail.com>
Cc: 13815@debbugs.gnu.org
Subject: bug#13815: Wrong mode for files with awkward shebang lines
Date: Mon, 25 Feb 2013 21:59:30 -0500 [thread overview]
Message-ID: <jwvhakzpzsw.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAHXt_SVn7GVKcpTSnabzJGzWWPrU8w_Lw-s5H53eJKaGukzEZA@mail.gmail.com> (Andrew Pennebaker's message of "Mon, 25 Feb 2013 16:56:03 -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
next prev parent reply other threads:[~2013-02-26 2:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-25 21:56 bug#13815: Wrong mode for files with awkward shebang lines Andrew Pennebaker
2013-02-26 2:59 ` Stefan Monnier [this message]
2013-02-26 8:12 ` Glenn Morris
2013-02-26 3:02 ` Glenn Morris
2021-08-23 1:13 ` Lars Ingebrigtsen
2021-08-23 15:06 ` Glenn Morris
2021-08-23 15:10 ` Lars Ingebrigtsen
2021-08-30 15:11 ` Glenn Morris
2021-08-31 1:54 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvhakzpzsw.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=13815@debbugs.gnu.org \
--cc=andrew.pennebaker@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).