A mode for interacting with a Janet REPL
How to set things up varies a bit depending on how one manages one's Emacs, e.g. straight.el, Doom, etc. What's common to all situations is likely:
Ensure janet-ts-mode or
janet-mode
is installed and configured. (If using janet-mode
,
replace janet-ts-mode
and janet-ts-mode-hook
below with
janet-mode
and janet-mode-hook
respectively.)
Clone this repository.
I add the following sort of thing to my .emacs
-equivalent:
(straight-use-package
'(ajrepl :host github
:repo "sogaiu/ajrepl"
:files ("*.el" "ajrepl")))
(use-package ajrepl
:straight t
:config
(add-hook 'janet-ts-mode-hook
#'ajrepl-interaction-mode))
The following might work for Doom:
(package! ajrepl
:recipe (:type git
:host github
:repo "sogaiu/ajrepl"
:files (:defaults ("ajrepl/"
"ajrepl/*"))))
(use-package! ajrepl
:after janet-ts-mode
:config
(add-hook 'janet-ts-mode-hook
#'ajrepl-interaction-mode))
If you cloned to ~/src/ajrepl
, add the following to your
.emacs
-equivalent:
(add-to-list 'load-path
(expand-file-name "~/src/ajrepl"))
(require 'ajrepl)
(add-hook 'janet-ts-mode-hook
#'ajrepl-interaction-mode)
Open a Janet file
Start an interactive REPL for Janet by M-x ajrepl
.
A buffer for a Janet repl should appear.
Various forms of sending things to the REPL should be possible, e.g.
C-c C-b
)C-x C-e
)C-c C-u
) - see below for detailsC-c C-r
)If Emacs' menus are enabled, there should be a Ajrepl
menu
which shows the above (and other) commands.
ajrepl-send-expression-upscoped
can be handy when evaluating forms
such as (import ...)
which might otherwise lead to output one might
not be interested in.
There's also a file named ajrepl-experiment.el
that contains some
experimental (aka "may not stick around") functionality.
If the file is required, it should add some additional things to the
Ajrepl
menu.