Thanks tmtxt for his plugin n4js.el
babel-cli
:npm install -g babel-cli
- Clone it into your
.emacs.d
and add it into load path
(add-to-list 'load-path "~/.emacs.d/babel-repl/")
- Load the library with
require
(require 'babel-repl)
If you get weird characters in your REPL. Add this code snippet to your configuration file.
(require 'comint)
(add-to-list 'comint-preoutput-filter-functions
(lambda (output)
(replace-regexp-in-string "\033\\[[0-9]+[A-Z]" "" output)))
Change these variables based on your demand
babel-repl-cli-program
: the name of babel node cli program, default tobabel-node
. Change it to absolute path if it's not in your load path.
(setq babel-repl-cli-program "/path/to/babel-node")
-
babel-repl-cli-arguments
: the list of arguments to pass tobabel-node
. -
babel-repl-pop-to-buffer
: whether to pop up the babel shell buffer after sending command to execute. -
babel-repl-pop-to-buffer-function
: the function used for pop up the babel node buffer if the above variable is set to t. Default ispop-to-buffer
. An example ispop-to-buffer
to pop up the babel buffer to current window instead of other window.
babel-repl
: start a babel node processbabel-repl-send-current-region
: send the active region to babel node processbabel-repl-send-buffer
: send the whole buffer to babel node processbabel-repl-send-paragraph
: send the paragraph at point to babel node processbabel-repl-send-region-or-buffer
: send the current region if active, otherwise send the whole buffer to babel node processbabel-repl-send-dwim
: send the current region if active, otherwise send the paragraph at point to babel node processbabel-repl-switch-to-buffer
: switch to babel node buffer if exist, otherwise, start a new one
(setq babel-repl-cli-arguments '("--trace-sync-io"))