Tuesday, May 25, 2010

One Emacs, many projects

Often I'll be editing code in an ENSIME enabled project, and I'll want to quickly switch over to another Scala file that's not part of my project. In the SLIME way of doing things, the newly opened file will use the value of slime-default-connection to issue commands to the server process. This value is shared amongst all slime-mode buffers, and is only changed if the user explicitly requests that it be changed. This works well in Lisp, where the Lisp process is not really coupled to any project ... you might want to eval code from many locations. Oftentimes you eval code that's not part of any project -- just lisp forms in a temporary buffer.

An ENSIME server, however, is designed to provide services to exactly one project. So if I open a random file, I don't want that file to be associated with my project's connection unless that source is part of my project.

After today's changes, ENSIME will determine the appropriate connection by examining the currently visited file-name and comparing it to the project information associated with all active connections. This fixes the issue where out-of-project Scala buffers would send commands to our project's connection. It also allows for multiple, coexisting projects.

No comments:

Post a Comment