-
-
Notifications
You must be signed in to change notification settings - Fork 180
inf clojure REPL
#Introduction
Using inf-clojure
with boot
should be a simple task, because there are no external dependencies whatsoever. The simplicity of setup and use may appeal to some, but those who seek a REPL with more advanced functionality should take a look at CIDER instead.
For code-completions to work with company-mode, the repl needs to be started with the '--no-colors' flag so ANSI color codes won't be injected into your *inf-clojure*
process output.
There are two predominant ways of connecting to your boot repl:
- Start the server and connect a client both from within Emacs
- Start the server in your boot
deftask
or from command line, and connect a client from Emacs
Setting inf-clojure-program
to boot -C repl
should just work.
(setq inf-clojure-program "boot -C repl")
Running M-x inf-clojure
will start a repl server and connect to it.
In your build.boot
, compose (repl :server true)
into your task. Alternatively, you could run boot -C repl -s
in your command line.
Set inf-clojure-program
to start just the client:
(setq inf-clojure-program "boot -C repl -c")
The client will detect the existence of .nrepl-port
in your project root directory, and connect to the correct repl.
To connect to a specific port, add the following to your Emacs configuration:
(defun run-boot-repl (x)
(interactive "sEnter Port Number:")
(run-clojure (format "boot -C repl -cp %s" x)))
Once the nrepl server is started, take note of the port number, and connect to it in emacs by running M-x run-boot-repl
.
#Usage
You can start inf-clojure and switching to the repl by running C-c C-z
from your Clojure source files.
Some additional helper functions:
(defun reload-current-clj-ns (next-p)
(interactive "P")
(let ((ns (clojure-find-ns)))
(message (format "Loading %s ..." ns))
(inf-clojure-eval-string (format "(require '%s :reload)" ns))
(when (not next-p) (inf-clojure-eval-string (format "(in-ns '%s)" ns)))))
This (re)loads the current namespace of the buffer. I bind this to C-c C-k
.
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util