lang/scala: fix REPL command for non-project files

run-scala errors out if you're not in a valid project.
This commit is contained in:
Henrik Lissner 2019-07-11 01:24:28 +02:00
parent aeb5cca727
commit d2b694ed53
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 16 additions and 1 deletions

View file

@ -33,3 +33,18 @@ Meant to be used for `scala-mode's `comment-line-break-function'."
(t
(newline nil t)
(indent-according-to-mode))))))
;;;###autoload
(defun +scala/open-repl ()
"Open a scala repl. Uses `run-scala' if in a sbt project."
(interactive)
(if (and (require 'sbt-mode nil t)
(sbt:find-root))
(run-scala)
(let ((buffer-name "*scala-repl")
buffer)
(unless (comint-check-proc buffer-name)
(setq buffer (make-comint-in-buffer
"scala-repl" buffer-name "scala")))
(display-buffer buffer)
buffer)))