To provide a better interaction experience between emacs elixir buffer and IEx sessions.
THIS PACKAGE IS WORKING IN PROGRESS.
Following is the installation with use-package, Tested under Emacs 27.1 .
With quelpa.
(use-package inf-iex
:hook (elixir-mode . inf-iex-minor-mode)
:quelpa (inf-iex :fetcher github
:repo "DogLooksGood/inf-iex"))
With straight.
(use-package inf-iex
:hook (elixir-mode . inf-iex-minor-mode)
:straight (inf-iex :type git
:host github
:repo "DogLooksGood/inf-iex"))
There’re two ways to play.
Inf-IEx contains a very basic support for IEx session with comint. At this moment, it doesn’t have a nicer code completion or navigation. But it allows us to eval code in code buffer.
A nice package, emamux, help us to interact with tmux sessions, and it is be used by Inf-IEx. By using a native IEx session in shell, we have code completion, and it also gives us the ability to to connect through a SSH connection(running SSH session in a local tmux).
Key Binding | Functionality |
---|---|
C-c C-z | Start IEx comint buffer. |
C-c C-v | Switch between sending target, tmux or comint buffer. |
C-c C-c | Send region or current line to target. |
C-c C-n | Eval and wrap code with :timer.tc, return nanoseconds. |
C-c C-w | Eval with bindings those read from minibuffer. |
C-c C-k | Reload current module. |
C-c C-l | Compile current file. |
C-c M-p p | Add Pry section to above line. |
C-c M-p k | Remove Pry section in this file. |
C-c M-p l | Goto Pry section. |
C-c C-s c | Query process state from process list. |
C-c C-s s | Query process state from Swarm registry. |
C-c C-i | Send i {thing-at-point} to IEx. |
C-c M-c | Import this module and its imports & requires. |
C-c M-r | Like C-c M-c , but respawn . |
Use C-c C-z
, project root detection should work.
Use C-c M-c
to import current module and module’s imports and requires.
Use C-c M-r
to respawn a new session.
Evaluate region or current line with C-c C-c
.
To measure execution cost, use C-c C-n
, nanoseconds will be returned.
To Evaluate with bindings, use C-c C-w
.
NOTE: You may want to put playground code in comment, prefix #
and iex>
will be trimed.
Use C-c C-v
to switch target between tmux and comint buffer.
Use C-c C-k
.
Use C-c C-l
**this feature only works with IEx in Emacs
We can query process state by pick a process name from a list.
Currently, only following registry is supported.
C-c C-s c
For those have a:registered_name
, listing byProcess.list
.C-c C-s s
For those registered with Swarm.
After pick the process in minibuffer, a inspector will display its state.
And you can use buttons on top to define state as variable or kill this process.
I’m new to Elixir, so if you want a type of registry to be supported, just submit an issue!
Insert a pry at above line with C-c M-p p
. After insertion, module will be reloaded automatically.
Click RET
it remove.
C-c C-i
can be used to inspect values when working with Pry.
Question: How to solve error “file-remote-p: Wrong type argument: stringp, nil” when starting IEx comint buffer?
Answer: INF IEX will call (project-current)
in Emacs which will read git info in current path. Please make sure that you have done git init
for the Elixir project.