When creating projects with elm init
, elm creates a project structure where there is a elm.json
in the root of the project directory and a src
folder, where your .elm files should go
Elm-mode for emacs doesn't seem to support this. When visiting a file in the src
directory and typing C-c C-c
to compile the file, I get the following error:
-*- mode: elm-compilation; default-directory: "~/Projects/select-elm/src/" -*-
Elm-Compile started at Mon May 13 04:29:55
/home/chris/.nvm/versions/node/v8.9.3/bin/elm make Main.elm --output\=elm.js
-- FILE NOT FOUND --------------------------------------------------------------
You want me to compile this file:
Main.elm
I cannot find it though! Is there a typo?
Elm-Compile exited abnormally with code 1 at Mon May 13 04:29:56
This is the same error you get when calling elm make Main.elm
from the command line in the src
folder instead of in the root folder of the project.
If this same file is saved to the root folder of the project, C-c C-c
compiles the file without errors. It seems elm-mode
expects source files to be directly in the root directory of a project, while the elm language convention is to save the source files in the src
folder.
I'm using elm 0.19.0. Is there a graceful way to make elm-mode "project aware", or something similar?
Unfortunately I don't have the option of simply saving my files to the root folder of the project because this is not a project that I own.
C-c C-c
is bound toelm-compile-buffer
, which basically runselm make <filename of current buffer>
in the current directory.C-c M-c
is bound toelm-compile-main
which will basically runelm make Main.elm
in the current directory, even ifMain.elm
isn't there. – nega May 13 '19 at 17:48elm-mode
. You can see whatelm-mode
settings you can customize (M-x customize-mode RET elm
), or you can file an issue with theelm-mode
developers. Be explicit with how your project is set up, and help you with customization, or add the features you need. – nega May 13 '19 at 17:52elm init
created, which is why I'm confused; elm and elm-mode seem to have divergent notions of their project structure. Looking at the sources, I also saw that elm-mode does a lot withdefault-directory
, which when you're visiting a file is the directory the file resides in. This is why I mentioned "project aware" above. I'm still debugging though and will report back. – flooose May 13 '19 at 20:32