sheepduke / scala-repl.el

Scala REPL in Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package scala-repl.el

Introduction

This package `scala-repl.el` intends to bring REPL driven development experience to Emacs, for Scala hackers.

It automatically detects the project root by simply searching for build.sbt or build.sc files in the current folder and its ancestors, till the root folder. When nothing is found, it will simply invoke scala-cli. The command to run when a project is (not) found is configurable.

Usage

To use this package, simply put it under your load path and run:

(require 'scala-repl)
  • scala-repl-run fires an REPL and attach to it in an automatic way.
  • scala-repl-run-custom simply runs an REPL with custom commands. The REPL will not be attached automatically.
  • scala-repl-attach sets some buffer-local variables to attach the “current” buffer to an REPL. You only need it when you are manually starting an REPL.
  • scala-repl-detach as you can guess from its name.
  • scala-repl-restart restarts the attached REPL process.
  • scala-repl-clear cleans the content of attached REPL buffer.
  • scala-repl-eval-buffer, scala-repl-eval-region-or-line, scala-repl-eval-region and scala-repl-eval-current-line are used to evaluate your code.

There are some other commands that will use :load function. But I did not make it work with package definition though. If you know how, please open an issue and teach me. :-)

Customization

  • scala-repl-command-alist can be used to define the mappings between project type (sbt, mill or NIL) and corresponding commands to invoke. Each argument of the command is one element in the list. By default it is set to:
    '((mill "mill" "-i" "_.console")
      (sbt "sbt" "console")
      (nil "scala-cli" "repl" "-deprecation"))
        
  • scala-repl-buffer-basename specifies the default “base” name for REPL buffer. You probably do not need/want to change it, although you are free to mess with it and see what changes.

About

Scala REPL in Emacs

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%