This is a minor mode for interacting with a Julia REPL running inside Emacs. The julia
process is started in an ANSI terminal (term
), which allows text formatting and colors, and interaction with the help system and the debugger.
It is recommended that you use this minor mode with julia-mode.
Please make sure you have at least Emacs 25. The term
code changed a bit since Emacs 24, and the package does not support it. For example, Ubuntu users can get the latest Emacs snapshot here.
Place this in your Emacs initialization files (eg .emacs
):
(add-to-list 'load-path path-to-julia-repl)
(require 'julia-repl)
(add-hook 'julia-mode-hook 'julia-repl-mode) ;; always use minor mode
If you want to use a Julia executable other than julia
in your path, set
(julia-repl-set-executable "/path/to/julia")
M-x julia-repl
, or C-c C-z
from a buffer in which the julia-repl
minor mode is active starts a new inferior Julia process. The keys below can be used to interact with this process.
key | action |
---|---|
C-c C-c |
send region (when applicable) or line to REPL |
C-c C-b |
send whole buffer to REPL (using include) |
C-u C-c C-b |
send whole buffer to REPL (directly) |
C-c C-z |
raise the REPL or create a new one |
C-RET |
send line to REPL (without bracketed paste) |
C-c C-e |
invoke @edit on region (when applicable) or line |
C-c C-d |
invoke @doc on symbol |
C-c C-w |
workspace() |
C-c C-m |
expand macro |
All actions that send something to the REPL terminate with a newline, triggering evaluation. If you want to avoid sending a newline (eg maybe because you want to edit an expression), use prefix arguments (C--
or C-u
, currently both have the same effect). This of course does not apply to C-c C-b
.
All commands send code using bracketed paste. When Julia is waiting for input, control characters like ^[[200~
may show up in your buffer, this is innocuous. If you input takes a long time to evaluate, you can step through it line-by-line with C-RET
.
Also, note some keybindings for term
:
C-x C-j
switches to line mode, where you can kill/yank, move around the buffer, use standard Emacs keybindings,C-c C-k
switches back to char mode,- for scrolling, use
S-<prior>
andS-<next>
.
See the help of term
for more.
- See the issues.
A well-known alternative is ESS, which also supports Julia. julia-repl
was written because I could not use Gallium from ESS, which is based on comint
, and thus does not allow a fully functioning terminal. Also, relying on the interactive features of the Julia REPL implies that I would not need to change this library to incorporate extensions and changes.