From: Andrew Pennebaker <andrew.pennebaker@gmail.com>
To: 13815@debbugs.gnu.org
Subject: bug#13815: Wrong mode for files with awkward shebang lines
Date: Mon, 25 Feb 2013 16:56:03 -0500 [thread overview]
Message-ID: <CAHXt_SVn7GVKcpTSnabzJGzWWPrU8w_Lw-s5H53eJKaGukzEZA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 981 bytes --]
Some of my Scala code opens as Shell script major mode in Emacs, a problem
caused by several factors:
In order to enable dot-slashing for Scala scripts, programmers sometimes
start their code as follows:
#!/bin/sh
exec scala "$0" "$@"
!#
object Hello {
def main(args: Array[String]) {
println("Hello World!")
}
}
This is an awkward shebang line; due to the nature of shebangs, it must be
split across three lines of code, starting with #!/bin/sh.
This creates problems for Emacs, as Emacs uses `file` to detect which major
mode should be used, and `file` returns 'text/x-shellscript' when a file
begins #!/bin/sh, regardless of the file extension or programming language
content the file actually contains.
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.
We can't trust mimetypes for code that contains these awkward shebangs.
--
Cheers,
Andrew Pennebaker
www.yellosoft.us
[-- Attachment #2: Type: text/html, Size: 1569 bytes --]
next reply other threads:[~2013-02-25 21:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-25 21:56 Andrew Pennebaker [this message]
2013-02-26 2:59 ` bug#13815: Wrong mode for files with awkward shebang lines Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHXt_SVn7GVKcpTSnabzJGzWWPrU8w_Lw-s5H53eJKaGukzEZA@mail.gmail.com \
--to=andrew.pennebaker@gmail.com \
--cc=13815@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.