I am running a remote nrepl server (mvn clojure:nrepl) and connecting via emacs M-x cider-connect. When the JVM exists for any reason or I call (System/exit 0) in my repl the *nrepl* buffer is immediately closed.
How do I prevent that behavior?
How do I make it so that subsequent connections reuse that buffer?
Thanks!
edit: previous: "connecting via emacs M-x nrepl"
update:
switched to:
; CIDER 0.8.0alpha (package: 20141116.1221) (Java 1.7.0_21, Clojure 1.6.0, nREPL 0.2.5)
if I run mvn dependency:tree what I see includes the following:
[INFO] +- org.clojure:tools.nrepl:jar:0.2.5:compile
[INFO] +- cider:cider-nrepl:jar:0.8.0-SNAPSHOT:compile
however in Emacs I see the following after a M-x cider-connect:
; CIDER 0.8.0alpha (package: 20141116.1221) (Java 1.7.0_21, Clojure 1.6.0, nREPL 0.2.5)
WARNING: The following required nREPL ops are not supported:
apropos classpath complete eldoc info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand ns-list ns-vars resource stacktrace toggle-trace-var toggle-trace-ns undef
Please, install (or update) cider-nrepl 0.8.0-SNAPSHOT and restart CIDER
and after closing the REPL and then trying to restart it I see An nREPL connection buffer already exists ... create a new one? (y or n) either answer appears to be the wrong one.
The old buffer isn't deleted at least, but it appears unusable.
Related
I've been trying to use sbt for one of my projects, however I've ran into the following problem - when I try to use sbt console to get the scala's REPL, it just doesn't allow any input. Example session:
[lared#lt foo]$ sbt
[info] Set current project to foo (in build file:/tmp/foo/)
> console
[info] Updating {file:/tmp/foo/}foo...
[info] Resolving org.scala-lang#scala-reflect;2.10.3 ...
[info] Done updating.
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.3 (OpenJDK 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
I can not type anything. It doesn't seem to take much RAM/CPU time. The problem is reproducible in any directory, regardless of if it does have a proper project structure (for example the SBT Hello World tutorial) or not.
I'm using sbt 0.13.1 and the JDK/Scala versions as seen above on Fedora 21.
The problem was solved by deleting ~/.ivy2/ and (perhaps unrelated) migration to Oracle Java 1.7 SDK.
I could not find a way to get the Fedora 24 installed sbt 0.13.1 console to work either so I downloaded the latest sbt (currently 0.13.12), unzipped into /opt and add the sbt binary to my path before /usr/bin/sbt.
The earlier suggestion to delete ~/.ivy2 did not work for me.
I can get auto-complete in an Ensime buffer containing Scala code but not in the Scala REPL launched from ensime. I wish to have auto-complete work in the Scala REPL launched from ensime. How can I fix this? I am using the following:
Scala 2.9.1
sbt 0.13.5
scala-mode2 from elpa
I also have this for the contents of plugins.sbt:
addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "0.1.2")
Now, the only other thing I have noticed is that in my .ensime file, it appears to be compiling for scala version 2.10. Note, that I can get auto-complete if I open scala from a terminal.
In summary, how can I get auto-complete from the scala REPL launched from ensime?
I am going to repost CodeKingPlusPlus's own comment on this question:
Apparently this is not a feature of Ensime, I asked on their github.
In the last version of scala (2.10.3) REPL, I can type exit to quit from REPL. However, in Scala 2.11.0 this doesn't work.
$ scala
Welcome to Scala version 2.11.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> exit
<console>:8: error: not found: value exit
exit
^
scala>
I ran into the same issue on upgrade, just use colon q.
:q
Additionally, exit was deprecated in 2.10.x with sys.exit suggested instead, so this works as well:
sys.exit
As a side note, I think they did this so you can distinguish between exiting the scala console in sbt and exiting sbt itself, though I could be wrong.
You options to leave the REPL as stated in the answers before are:
:quit
:q
Ctrl + d // Unix
Ctrl + z // Windows
sys.exit
Use the end of file characters. Ctrl-D on linux, Ctrl-Z on Windows.
Using the :help command on my 2.10.3 REPL gets me this hint:
:quit exit the interpreter
I don't know whether :quit is still there in 2.11.0 or not though.
When I use exit in 2.10.4, I got a warning:
warning: there were 1 deprecation warning(s); re-run with -deprecation for details
You can use:
:q
:quit
sys.exit
all of them work in 2.11.x.
You can use
sys.exit
OR
:q
to exit the shell
For sbt 1.4.1 commands use below command
exit:Terminates the remote client or the build when called from the console.
shutdown:Terminates the build.
Example
vudikeri#C02CP3LAMD6M scala % sbt version
[info] welcome to sbt 1.4.1 (N/A Java 14.0.1)
sbt:scala> shutdown
[info] shutting down sbt server
vudikeri#C02CP3LAMD6M scala %
sbt:scala> exit
[info] shutting down sbt server
I can't seem to find similar issues.
On OSX, play2 bin seems to run okay but using sbt causes oom errors and scala files never complete compiling
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on port 9000...
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 15 Scala sources and 2 Java sources to
/Users/tripled153/Development/src/Foundation/playApp/target/scala-2.9.1/classes...
Java HotSpot(TM) 64-Bit Server VM warning: Exception
java.lang.OutOfMemoryError occurred dispatching signal Unknown Signal
to handler- the VM may need to be forcibly terminated
I'm running with extended memory settings but still no luck. Running in staged (prod) mode appears okay though.
rundev.sh
export SBT_OPTS="-Xms512M -Xmx3536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512M"
sudo sbt clean run
I'm trying to use sbt to generate an ensime configuration file as described in this tutorial:
http://jawher.net/2011/01/17/scala-development-environment-emacs-sbt-ensime/
The issue I'm having is that I cannot get sbt to generate a configuration file as the 'ensime generate' command does not appear to be part of the sbt command set.
[output]
[info] Building project ScalaTest 1.0 against Scala 2.9.2
[info] using sbt.DefaultProject with sbt 0.7.7 and Scala 2.7.7
[error] No method named 'ensime' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
[info]
[info] Total time: 0 s, completed 26-Jan-2013 12:53:48
[info]
[info] Total session time: 0 s, completed 26-Jan-2013 12:53:48
[error] Error during build.
[Steps followed]
cd <project directory> (sbt project root)
sbt 'ensime generate'
[Version info]
sbt 0.7.7
ensime 2.9.2-0.9.8.1
scala 2.9.2
[emacs configuration]
(add-to-list 'load-path "~/.emacs.d/scala-emacs")
(require 'scala-mode-auto)
(add-hook 'scala-mode-hook
'(lambda ()
(scala-mode-feature-electric-mode)
))
(require 'scala-mode)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
(add-to-list 'load-path "~/.emacs.d/ensime/elisp/")
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
(push "/media/xxx/Development/Runtimes/scala-2.9.2/bin/" exec-path)
(push "/media/xxx/Development/Tools/sbt/" exec-path)
Any help appreciated (I've checked all the paths so please no comments regarding this)
Cheers,
JLove
Have you added the ensime-sbt-cmd plugin to your sbt build? http://aemoncannon.github.com/ensime/index.html#tth_sEc3.1
it seems you need to quote the command on the shell i.e.:
$ sbt "ensime generate"
HTH
I had the same problem. After trying what you did, I solved it with these extra steps:
Install the latest version (as of writing, got 0.12.3 from http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html)
Edit the file project\build.properties and change the sbt.version accordingly (in my case, sbt.version=0.12.3)
Run sbt from the project root.
Since you already modified the plugins file, this should install the ensime command. If you want to run it from the command line, remember to quote the command (sbt "ensime generate").