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:
parent
aeb5cca727
commit
d2b694ed53
2 changed files with 16 additions and 1 deletions
|
@ -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)))
|
||||
|
|
|
@ -33,4 +33,4 @@
|
|||
|
||||
(def-package! sbt-mode
|
||||
:after scala-mode
|
||||
:config (set-repl-handler! 'scala-mode #'run-scala))
|
||||
:config (set-repl-handler! 'scala-mode #'+scala/open-repl))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue