Closed mcandre closed 11 years ago
I'm sorry to hear you are having problems. I bet it is something pretty trivial that you need to tweak.
Please check the following:
To make sure you have scala-mode properly installed, open a .scala file and type in M-x scala-mode. This should turn the scala-mode on and you should see the text "(Scala)" on the status row.
If this fails, please include a link to your emacs file here. Use gist, pastebin or other similar service.
Turns out mimetypes :( Emacs is doing the right thing, noticing my .scala
files have the text/x-shellscript
mimetype and opening them in shell script mode.
Mac is using the wrong mimetype, and there's no easy way to correct it.
http://superuser.com/questions/557281/how-can-i-set-a-files-mimetype-in-mac-os-x
I bet there are many other mac users (but I am not). Join the #scala irc channel and ask there for advice.
Or is Mac is anything like other unixes, then there might be a /etc/mime.types file that you can edit.
It turns out scala-mode2
is doing everything right. My shebang line is to blame:
#!/bin/sh
exec scala "$0" "$@"
!#
Because file
uses shebang lines to detect mimetypes, and Emacs uses mimetypes to assign major modes. So #!/bin/sh maps to 'text/x-shellscript' maps to Sh mode.
Do you happen to know a good shebang for Scala code that doesn't corrupt the mimetype?
I installed
scala-mode2
and added(require 'scala-mode2)
to~/.emacs
, but Emacs still treats.scala
files as.sh
shell scripts.