hvesalai / emacs-sbt-mode

An emacs mode for interacting with scala sbt and projects
GNU General Public License v3.0
126 stars 38 forks source link

`sbt:find-root` can return bad root if `sbt` executed in HOME by mistake #124

Closed mpmiszczyk closed 7 years ago

mpmiszczyk commented 7 years ago

Hi.

I just had the exact same problem as here: https://stackoverflow.com/questions/45925890/executing-sbt-run-in-current-project-with-ensime-emacs I was able to find a solution, but since I use emacs in server mode, and sbt:buffer-project-root is set only once, it caused a lot of confusion before I was able to pinpoint the problem.

But it made me wonder why are we looking for project/.. and *.sbt files. Since sbt-mode is (should?) used extensively with ensime, shouldn't we be looking mainly for .ensime file. Since it should be generated and is generated by the user in project root directory it should be the easiest way to determine where the root is. Even when using with sub-projects.

fommil commented 7 years ago

sbt-mode is independent of ensime, if you can think up another way to find the root please send a PR