Git Product home page Git Product logo

inf-iex's Introduction

INF IEX

To provide a better interaction experience between emacs elixir buffer and IEx sessions.

THIS PACKAGE IS WORKING IN PROGRESS.

Installations

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"))

IEx Sessions

There’re two ways to play.

Start IEx in Emacs comint buffer.

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.

Start IEx in a tmux window.

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).

Summary of shortcuts

Key BindingFunctionality
C-c C-zStart IEx comint buffer.
C-c C-vSwitch between sending target, tmux or comint buffer.
C-c C-cSend region or current line to target.
C-c C-nEval and wrap code with :timer.tc, return nanoseconds.
C-c C-wEval with bindings those read from minibuffer.
C-c C-kReload current module.
C-c C-lCompile current file.
C-c M-p pAdd Pry section to above line.
C-c M-p kRemove Pry section in this file.
C-c M-p lGoto Pry section.
C-c C-s cQuery process state from process list.
C-c C-s sQuery process state from Swarm registry.
C-c C-iSend i {thing-at-point} to IEx.
C-c M-cImport this module and its imports & requires.
C-c M-rLike C-c M-c, but respawn.
c-c M-d bOpen DBG list buffer.
C-c M-d dAdd current function to DBG list.
C-c M-d cDBG execute expression.

Start comint IEx session

Use C-c C-z, project root detection should work.

Execution Context

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.

Code evaluation

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.

Switch sending target

Use C-c C-v to switch target between tmux and comint buffer.

Reload module

Use C-c C-k.

Compile module

Use C-c C-l

Process state query

**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 by Process.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!

Pry

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.

DBG

**this feature only works with IEx in Emacs

Use c-c M-d d to add current function to DBG list.

Use C-c M-d b to open DBG List buffer, in this buffer, use n~/~p to navigate, k to remove, t to toggle.

Use C-c M-d c to execute expression with DBG.

Tracing result and output will be displayed in a new buffer.

FAQ

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.

inf-iex's People

Contributors

doglooksgood avatar frankyxhl avatar nykma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.