Run a Inferior-Crystal process in a buffer
inf-crystal provides a REPL buffer connected
to a icr subprocess.
It's based on ideas from the popular inferior-lisp
package.
inf-crystal
has two components - a basic crystal REPL
and a minor mode (inf-crystal-minor-mode
), which
extends crystal-mode
with commands to evaluate forms directly in the
REPL.
inf-crystal
provides a set of essential features for interactive
Crystal development:
- REPL
- Interactive code evaluation
To be able to connect to inf-crystal, you need to make sure that icr is installed. Installation instructions can be found on the main page of icr.
Available on all major package.el community maintained repos -
MELPA Stable and MELPA repos.
MELPA Stable is recommended as it has the latest stable version. MELPA has a development snapshot for users who don't mind breakage but don't want to run from a git checkout.
You can install inf-crystal
using the following command:
M-x package-install [RET] inf-crystal [RET]
or if you'd rather keep it in your dotfiles:
(unless (package-installed-p 'inf-crystal)
(package-refresh-contents)
(package-install 'inf-crystal))
If the installation doesn't work try refreshing the package list:
M-x package-refresh-contents
If you're installing manually, you'll need to:
- drop the file somewhere on your load path (perhaps ~/.emacs.d)
- Add the following lines to your .emacs file:
(autoload 'inf-crystal "inf-crystal" "Run an inferior Crystal process" t)
(add-hook 'crystal-mode-hook 'inf-crystal-minor-mode)
Run one of the predefined interactive functions.
See Function Documentation for details.
Clear out all of the accumulated commands.
Toggle debug mode off and on. In debug mode icr will print the code before executing it.
Enable paste mode.
Disable paste mode.
Clear the REPL buffer.
Kill the REPL buffer and its underlying process.
You can pass the target BUFFER as an optional parameter to suppress the usage of the target buffer discovery logic.
Restart the REPL buffer and its underlying process.
You can pass the target BUFFER as an optional parameter to suppress the usage of the target buffer discovery logic.
Launch a crystal interpreter in a buffer. using ‘inf-crystal-interpreter’as an inferior mode.
Argument CMD defaults to ‘inf-crystal-interpreter’. When called interactively with ‘prefix-arg’, it allows the user to edit such value.
Switch to the inf-crystal process buffer. With argument, positions cursor at end of buffer.
Send the previous sexp to the inferior crystal process.
Send the current line to the inferior crystal process.
Send the current definition to the inferior crystal process.
Send the current definition to the inferior Crystal. Then switch to the process buffer.
Send the region delimited by START and END to inferior crystal process.
Send the region delimited by START and END to inferior crystal process. Then switch to the process buffer.
Send the current buffer to the inferior crystal process.
Send the current buffer to the inferior crystal process. Then switch to the process buffer.