Coder Social home page Coder Social logo

eval-in-repl's Introduction

eval-in-repl: Consistent ESS-like eval interface for various REPLs

This package does what ESS does for R for various REPLs.

Emacs Speaks Statistics (ESS) package has a nice function called ess-eval-region-or-line-and-step, which is assigned to C-RET. This function sends a line or a selected region to the corresponding shell (R, Julia, Stata, etc) visibly. It also start up a shell if there is none.

This package implements similar work flow for various read-eval-print-loops (REPLs) shown below.

The languages currently supported are: Emacs Lisp, Clojure, Common Lisp, Racket, Scheme, Hy, Python, Ruby, Standard ML, OCaml, Prolog, Javascript, shell script, Elixr, Erlang, Elm..

Usage: C-RET rules all

After installation and appropriate configuration (see below), you can use C-RET in a source file to start up an appropriate REPL (except cider, which needs manual M-x cider-jack-in) and evaluate a line, selected region or the current expression depending on the context. The script will be shown in one window, and the REPL in another. The REPL shows both the code executed and the value the code evaluated to. The cursor steps to the next expression in the source file (only when invoked without a selected region). A more detailed explanation is available at Qiita (http://qiita.com/kaz-yos/items/bb8016ec79cfbbf328df ).

Emacs Lisp via IELM (screencast)

You can see C-RET in action.

ielm

Clojure via cider.el

cider

Python via python.el

python

Shell script

shell

Installation

eval-in-repl.el is available on the MELPA repository. You can do the following, then choose and install eval-in-repl.

M-x list-packages

To configure the MELPA, see this: http://melpa.milkbox.net/#/getting-started

The following files are included in the package. There are respective dependencies for each language-specific file that are NOT automatically installed.

  • eval-in-repl.el

  • Skeleton package required by all specialized packages below.

  • eval-in-repl-ielm.el (depends on IELM; part of default emacs installation)

  • Support for Inferior Emacs Lisp Mode

  • eval-in-repl-cider.el (depends on cider.el)

  • Support for Clojure via cider.el

  • eval-in-repl-slime.el (depends on slime.el)

  • Support for Common Lisp via slime.el

  • eval-in-repl-geiser.el (depends on geiser.el)

  • Support for Racket and Guile Scheme via geiser.el

  • eval-in-repl-racket.el (depends on racket-mode.el)

  • Support for Racket via racket-mode.el (incompatible with geiser version)

  • eval-in-repl-scheme.el

  • Support for Scheme via scheme.el (depends on scheme.el and cmuscheme.el; both part of default emacs installation) (incompatible with geiser version)

  • eval-in-repl-hy.el (depends on hy-mode.el)

  • Support for Hy via hy-mode.el

  • eval-in-repl-python.el

  • Support for Python via python.el (depends on python.el; part of default emacs installation)

  • eval-in-repl-ruby.el (depends on ruby-mode.el, and inf-ruby.el)

  • Support for Ruby via ruby-mode.el

  • eval-in-repl-sml.el (depends on sml-mode.el)

  • Support for Standard ML via sml-mode.el

  • eval-in-repl-ocaml.el (depends on tuareg.el)

  • Support for OCaml via tuareg.el

  • eval-in-repl-prolog.el (depends on prolog.el; part of default emacs installation)

  • Support for Prolog via prolog.el

  • eval-in-repl-javascript.el (depends on js3-mode.el, js2-mode.el, and js-comint.el)

  • Support for Javascript via js-comint.el

  • eval-in-repl-shell.el

  • Support for shell

  • eval-in-repl-iex.el (depends on elixir-mode.el, and alchemist.el)

  • Support for Elixir via alchemist.el

  • eval-in-repl-erlang.el (depends on erlang.el)

  • Support for Erlang via erlang.el

  • eval-in-repl-elm.el (depends on elm-mode.el)

  • Support for Elm via elm-mode.el

Configuration

The full configuration is the following. eval-in-repl.el is always necessary. Require other files as needed and configure the respective mode-specific key bindings.

The REPL startup behavior has change in version 0.9.0. Previously, a specific window configuration (REPL on left, script on right, nothing else) was strictly enforced. The newer versions try to be less invasive. If only one window exists, necessarily window splitting occurs. The splitting behavior can be controlled by the eir-repl-placement option (either one of quoted symbols 'left, 'right, 'above, or 'below). When there are multiple windows present, you can choose which window to replace via ace-window for some languages (currently, IELM, Python, Hy, and shell only). For others, window splitting and replacement are controlled by the respective major/minor mode packages, and may be erratic.

The eir-always-split-script-window option introduced in version 0.9.1, when true, splits the current script window at REPL start up, but does not replace any other windows. This may be useful if you do not like to replace one of the windows that are already open, and create a new window for the REPL.

To recover the old behavior of the two-window layout, both eir-delete-other-windows and eir-always-split-script-window should be set to t.

;; require the main file containing common functions
(require 'eval-in-repl)

;; Uncomment if no need to jump after evaluating current line
;; (setq eir-jump-after-eval nil)

;; Uncomment if you want to always split the script window into two.
;; This will just split the current script window into two without
;; disturbing other windows.
;; (setq eir-always-split-script-window t)

;; Uncomment if you always prefer the two-window layout.
;; (setq eir-delete-other-windows t)

;; Place REPL on the left of the script window when splitting.
(setq eir-repl-placement 'left)


;;; ielm support (for emacs lisp)
(require 'eval-in-repl-ielm)
;; Evaluate expression in the current buffer.
(setq eir-ielm-eval-in-current-buffer t)
;; for .el files
(define-key emacs-lisp-mode-map (kbd "<C-return>") 'eir-eval-in-ielm)
;; for *scratch*
(define-key lisp-interaction-mode-map (kbd "<C-return>") 'eir-eval-in-ielm)
;; for M-x info
(define-key Info-mode-map (kbd "<C-return>") 'eir-eval-in-ielm)

;;; cider support (for Clojure)
;; (require 'cider) ; if not done elsewhere
(require 'eval-in-repl-cider)
(define-key clojure-mode-map (kbd "<C-return>") 'eir-eval-in-cider)

;;; SLIME support (for Common Lisp)
;; (require 'slime) ; if not done elsewhere
(require 'eval-in-repl-slime)
(add-hook 'lisp-mode-hook
		  '(lambda ()
		     (local-set-key (kbd "<C-return>") 'eir-eval-in-slime)))

;;; Geiser support (for Racket and Guile Scheme)
;; When using this, turn off racket-mode and scheme supports
;; (require 'geiser) ; if not done elsewhere
(require 'eval-in-repl-geiser)
(add-hook 'geiser-mode-hook
		  '(lambda ()
		     (local-set-key (kbd "<C-return>") 'eir-eval-in-geiser)))

;;; racket-mode support (for Racket; if not using Geiser)
;; (require 'racket-mode) ; if not done elsewhere
;; (require 'eval-in-repl-racket)
;; (define-key racket-mode-map (kbd "<C-return>") 'eir-eval-in-racket)

;;; Scheme support (if not using Geiser))
;; (require 'scheme)    ; if not done elsewhere
;; (require 'cmuscheme) ; if not done elsewhere
;; (require 'eval-in-repl-scheme)
;; (add-hook 'scheme-mode-hook
;; 	  '(lambda ()
;; 	     (local-set-key (kbd "<C-return>") 'eir-eval-in-scheme)))

;;; Hy support
;; (require 'hy-mode) ; if not done elsewhere
(require 'eval-in-repl-hy)
(define-key hy-mode-map (kbd "<C-return>") 'eir-eval-in-hy)


;;; Python support
;; (require 'python) ; if not done elsewhere
(require 'eval-in-repl-python)
(add-hook 'python-mode-hook
          '(lambda ()
             (local-set-key (kbd "<C-return>") 'eir-eval-in-python)))

;;; Ruby support
;; (require 'ruby-mode) ; if not done elsewhere
;; (require 'inf-ruby)  ; if not done elsewhere
(require 'eval-in-repl-ruby)
(define-key ruby-mode-map (kbd "<C-return>") 'eir-eval-in-ruby)

;;; SML support
;; (require 'sml-mode) ; if not done elsewhere
(require 'eval-in-repl-sml)
(define-key sml-mode-map (kbd "<C-return>") 'eir-eval-in-sml)
(define-key sml-mode-map (kbd "C-;") 'eir-send-to-sml-semicolon)

;;; OCaml support
;; (require 'tuareg) ; if not done elsewhere
(require 'eval-in-repl-ocaml)
(define-key tuareg-mode-map (kbd "<C-return>") 'eir-eval-in-ocaml)
;; function to send a semicolon to OCaml REPL
(define-key tuareg-mode-map (kbd "C-;") 'eir-send-to-ocaml-semicolon)

;;; Prolog support (Contributed by m00nlight)
;; if not done elsewhere
;; (autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
;; (autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
;; (autoload 'mercury-mode "prolog" "Major mode for editing Mercury programs." t)
;; (setq prolog-system 'swi)
;; (setq auto-mode-alist (append '(("\\.pl$" . prolog-mode)
;;                                 ("\\.m$" . mercury-mode))
;;                                auto-mode-alist))
(require 'eval-in-repl-prolog)
(add-hook 'prolog-mode-hook
          '(lambda ()
             (local-set-key (kbd "<C-return>") 'eir-eval-in-prolog)))

;;; Javascript support
;; (require 'js3-mode)  ; if not done elsewhere
;; (require 'js2-mode)  ; if not done elsewhere
;; (require 'js-comint) ; if not done elsewhere
(with-eval-after-load 'js3-mode
  (require 'eval-in-repl-javascript)
  (define-key js3-mode-map (kbd "<C-return>") 'eir-eval-in-javascript))
(with-eval-after-load 'js2-mode
  (require 'eval-in-repl-javascript)
  (define-key js2-mode-map (kbd "<C-return>") 'eir-eval-in-javascript))


;; Shell support
(require 'eval-in-repl-shell)
(add-hook 'sh-mode-hook
          '(lambda()
             (local-set-key (kbd "C-<return>") 'eir-eval-in-shell)))
;; Version with opposite behavior to eir-jump-after-eval configuration
(defun eir-eval-in-shell2 ()
  "eval-in-repl for shell script (opposite behavior)

This version has the opposite behavior to the eir-jump-after-eval
configuration when invoked to evaluate a line."
  (interactive)
  (let ((eir-jump-after-eval (not eir-jump-after-eval)))
       (eir-eval-in-shell)))
(add-hook 'sh-mode-hook
          '(lambda()
             (local-set-key (kbd "C-M-<return>") 'eir-eval-in-shell2)))

;;; Elixir support
;; (require 'elixir-mode) ; if not done elsewhere
;; (require 'alchemist)   ; if not done elsewhere
(require 'eval-in-repl-ruby)
(define-key elixir-mode-map (kbd "<C-return>") 'eir-eval-in-iex)

;;; Erlang support
;; (require 'erlang-mode) ; if not done elsewhere
(require 'eval-in-repl-erlang)
(define-key erlang-mode-map (kbd "<C-return>") 'eir-eval-in-erlang)

;;; Elm support
;; (require 'elm-mode) ; if not done elsewhere
(require 'eval-in-repl-elm)
(define-key elm-mode-map (kbd "<C-return>") 'eir-eval-in-elm)

Known issues

  • racket-mode support and scheme support are not well tested as I use Geiser.
  • The eir-always-split-script-window option is not functional for cider.
  • The choice of a buffer for the REPL is dependent on the corresponding major/minor modes, and may be erratic.
  • cider currently requires manual start up with cider-jack-in.
  • The Geiser support is incompatible with the racket-mode support (racket-mode major mode is incompatible with Geiser) and with the scheme-mode support (Geiser will invoke Guile Scheme for .scm files).

Version history

  • 2017-07-30 0.9.6 Fix the implementation for inf-ruby.
  • 2017-07-30 0.9.5 Add eir-use-python-shell-send-string option (default to t). This avoids errors on blank lines by using python-mode's python-shell-send-string function. However, this does not allow showing code in the REPL. To recover the old behavior, set to nil.
  • 2016-12-24 0.9.4 Add eir-ielm-eval-in-current-buffer. When this is t, ielm's ielm-working-buffer is always changed to the current buffer prior to evaluation.
  • 2016-04-18 0.9.3 Drop cider REPL start up function since it was not working.
  • 2016-02-27 0.9.2 Deactivate selection explicitly as it is required in Emacs 25.
  • 2016-01-17 0.9.1 Add eir-always-split-script-window, which when turned on, splits the current script window at REPL start up, but does not replace any other window.
  • 2016-01-01 0.9.0 Do not mess with the window layout at REPL startup (as much as before). eir-repl-placement option to control where the REPL shows up. New dependency on ace-window.el.
  • 2015-11-22 0.8.0 Add Javascript support (Thanks stardiviner); Drop essh.el dependency
  • 2015-09-05 0.7.0 Add Prolog support (Thanks m00nlight); no jump option for other languages
  • 2015-06-05 0.6.0 Add defcustom configuration to configure whether to jump after eval (Thanks arichiardi)
  • 2014-12-28 0.5.1 Refactoring, comment and documentation changes.
  • 2014-12-21 0.5.0 Add Hy and OCaml support
  • 2014-12-04 0.4.1 Require slime-repl.el (Thanks syohex)
  • 2014-11-26 0.4.0 Add Ruby support
  • 2014-11-12 0.3.0 Add Standard ML support
  • 2014-09-13 0.2.1 Add EOF handling for Python
  • 2014-08-30 0.2.0 Add Geiser and Racket support
  • 2014-07-06 0.1.1 Delete excess autoload macros, add paredit.el to dependency
  • 2014-06-30 0.1.0 First MELPA Release

Special thanks:

eval-in-repl's People

Contributors

actondev avatar akirak avatar arichiardi avatar jcai849 avatar kaz-yos avatar naupaka avatar nicolas-graves avatar stardiviner avatar syohex avatar tarsius avatar terlar avatar theldoria avatar wentasah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eval-in-repl's Issues

Make require js3-mode conditionally

I use use-package to load eval-in-repl. Seems eval-in-repl require js3-mode explicitly. I think this should be conditionally by using if condition (featurep 'js3-mode) to detect.

Here is the error I got:

Error (use-package): eval-in-repl/:config: Cannot open load file: No such file or directory, js3-mode

Tagging releases

Hi,

please tag the latest release 0.2.0 as such in git, so that melpa-stable will also be able to pick it up.

Thanks!!

Suggestion: Frame support?

Description

By frame support, I mean allowing the REPL buffers to show on a different "frame" (i.e. "window", in a normal term).

If this is made possible, the REPL output can be moved to a second display, which is the primary incentive for me to propose this.

Questions

I want to know what you would think.
Is this outside the scope of this library?
Would it be easy to implement this behavior?

Can't evaluate individual lines in functions

Given the Python:

def foo():
    print "hello"
    print "world"

If point is on the print "hello" line, then I'd expect it to just send that line to *Python*. Instead, it sends the whole function body.

use *-term instead of shell?

Firstly, thank you for this excellent package!

I am brand new to both emacs and elisp, so forgive me if this is a trivial PR (or obviously a bad idea), but would it be possible to extend the package to allow the evaluation of bash code in multi-term or ansi-term as opposed to shell?

Regardless, thanks for your work!

Make "jump to the next top form" optional

As you wrote in your README, when developing, the workflow is to have code on one side and evaluate the changes of your functions in the repl.

I find not very useful to jump to the next form every time that you evaluate, and I would like to ask if possible to make it optional through a defcustom so that it can be set to false (can be left on by default so we don't break the current behaviour).

Thank you for this wonderful addition, I was waiting for and when I found it I immediately share it on my twitter @richiardiandrea 😄

inf-clojure integration

Hello again, this time with another idea !

Inf-clojure comes as a lighter alternative to cider for Clojure and it is usually triggered by calling M-x inf-clojure. People are using it because it does one thing only and well (as every tool should be!).

It would be a great fit in eval-in-repl imho 😀

As usual, thanks for your work, I use this package a lot.

Expose a function to just launch the REPL without evaluating something

This is already available through the eir-repl-start function, but it would be nice to not have to replicate the knowledge of how those things are setup.

So for example wrap this inside a function:
(eir-repl-start "\\*ruby\\*" #'inf-ruby t)

Like:

(defun eir-repl-start-ruby ()
  (interactive)
  (eir-repl-start "\\*ruby\\*" #'inf-ruby t))

If this is something you agree with I could make the change for all packages. Then people who want to reuse the logic to get a REPL can require/autoload that part.

essh is not available

I found there is one line (essh-next-code-line) in eir-eval-in-ruby definition.
But I have not found essh in Emacs library. And there there is no this package in MELPA.

First commands not send to shell (windows)

The first command (or region) I send using eir-eval-in-shell (or eir-eval-in-shell2) is not executed. Afterwards, while the buffer *shell* exists, the commands work.

Tested using windows native shell (cmd).

function definition is void: switch-to-js (probably solved)

Dear Kazuki,

Thank you for this great package -- I wanted ``geiser for (js|ruby|python|R)'' and here they are, all in one!
I found a small issue with js support (emacs24-nox on debian) -- it does not work out of the box, complaining about switch-to-js function. Brutal (defalias 'switch-to-js 'js-comint-switch-to-repl) seems to do the trick, but I am pretty ignorant about elisp, so perhaps it's not the best solution?

Best regards!

Don't hide other windows, only show two windows from eir.

I found eval-in-repl will hide other windows, only show two windows, one is the source code buffer, and the other is the repl buffer. Sometimes I open many buffers, this behavior is bad. I have to open those buffers again, and I even can't remember which buffers I opened.
It has one benifit, it's clear.
I think this might need an option to toggle this behavior?

Racket-mode support uses unavailable function

eval-in-repl-racket.el uses the function racket--repl-show-and-move-to-end from racket-mode. However, this function is no longer available. I'm not sure what it has been replaced with, but the issue can be fixed by replacing the function with it's previous implementation. That is

(defalias 'eir-send-to-racket
  (apply-partially 'eir-send-to-repl
                   ;; fun-change-to-repl
                   #'(lambda ()
                       ;; Show Racket REPL (focus comes back)
                       (racket--repl-show-and-move-to-end)
                       ;; Go to the other window
                       (other-window 1))
                   ;; fun-execute
                   #'comint-send-input)
  "Send expression to *Racket REPL* and have it evaluated.")

Can be rewritten as

(defalias 'eir-send-to-racket
  (apply-partially 'eir-send-to-repl
                   ;; fun-change-to-repl
                   #'(lambda ()
                       ;; Show Racket REPL (focus comes back)
                       (display-buffer racket-repl-buffer-name)
                       (save-selected-window
			  (select-window (get-buffer-window racket-repl-buffer-name))
			  (comint-show-maximum-output))
                       ;; Go to the other window
                       (other-window 1))
                   ;; fun-execute
                   #'comint-send-input)
  "Send expression to *Racket REPL* and have it evaluated.")

Probably not the prettiest solution but it fixes the issue.

Send buffer to repl

Is there a way of using this to send the whole buffer to the REPL?

AS the switch by mode is done by setting the same key to different functions in each keymap it is not as easy to generalise as select the buffer and call an eir function.

some changes to eir-eval-in-repl-python and creation of eir-eval-in-perl

Hello,
I have been wanting something like this package for a very long time so that I may have the ease of ess in arbitrary languages. I was super pleased to find it.

While playing with it in python, I had some very strange and difficult-to-reproduce problems with 'Overlapping strings detected'. I eventually hunted down my problems to python-nav-forward-*. Since I know ess a bit more than python.el, I decided to yank the logic from there and implement a python version of 'ess-eval-region-or-function-or-paragraph-and-step' (eerofopas) by mostly copy/pasting from ess.

In the process of making it work, I found myself looking at eir-eval-in-python-repl/python.el and thinking that the logic should work pretty easily with perl's various REPLs. So I did a little more copy/pasting and made eir-eval-in-perl-repl.

Finally, I added a function to eval-in-repl which is just a (cond ...) to invoke the various eval flavors depending on the current buffer's major mode.

I only about 75% finished any of these tasks though, as I needed to get back to work. If any of them are of interest, I would be happy to finish them, clean them up, and send a PR, as they are currently sitting in my fork.

I hope you are doing well.

Deselect region after eval

Currently, mark is always active after an expression is evaluated. We should restore the mark to its original state. That is, when mark-active is nil at the beginning, always restore it back afterward.

Blank lines in python functions don't work

Given the function:

def foo():
    x = 1

    y = x + 1

eir-eval-in-python makes python/ipython thinks that the function ends after x = 1, and tries to evaluate y = x + 1, producing NameError.

Looks like eir-send-to-python is getting the whole string, but it's being misunderstood by the inferior python process. It is possible to send whole functions to *Python* buffers, python-shell-send-defun does the right thing, so I'm not sure what needs changing.

do not see the command in repl

I am not able to see the executed command in the repl only the result for python. For example if I execute print("hello") I only see the result hello

I am using spacemacs with emacs 27.2 on a windows machine.

Thx.

Shell REPL not working.

Hi I am new to emacs. Here is what I have done. Thank you for any help in advance.

install eval-in-repl from melpa-stable
install essh.el by placing in load path
install eval-in-repl-shell.el in load path

relevant .emacs cutout:
;;--------------------------------------------------------------;;
(require 'essh)
(defun essh-sh-hook ()
(define-key sh-mode-map "\C-c\C-r" 'pipe-region-to-shell)
(define-key sh-mode-map "\C-c\C-b" 'pipe-buffer-to-shell)
(define-key sh-mode-map "\C-c\C-j" 'pipe-line-to-shell)
(define-key sh-mode-map "\C-c\C-n" 'pipe-line-to-shell-and-step)
(define-key sh-mode-map "\C-c\C-f" 'pipe-function-to-shell)
(define-key sh-mode-map "\C-c\C-d" 'shell-cd-current-directory))
(add-hook 'sh-mode-hook 'essh-sh-hook)
;;--------------------------------------------------------------;;

;;--------------------------------------------------------------;;
;; require the main file containing common functions
(require 'eval-in-repl)

;; Uncomment if no need to jump after evaluating current line
;; (setq eir-jump-after-eval nil)

;; Uncomment if you want to always split the script window into two.
;; This will just split the current script window into two without
;; disturbing other windows.
;; (setq eir-always-split-script-window t)

;; Uncomment if you always prefer the two-window layout.
;; (setq eir-delete-other-windows t)

;; Place REPL on the left of the script window when splitting.
(setq eir-repl-placement 'below)

;; Shell support
(require 'eval-in-repl-shell)
(add-hook 'sh-mode-hook
'(lambda()
(local-set-key (kbd "C-") 'eir-eval-in-shell)))
;; Version with opposite behavior to eir-jump-after-eval configuration
;;(defun eir-eval-in-shell2 ()
;; "eval-in-repl for shell script (opposite behavior)

;;This version has the opposite behavior to the eir-jump-after-eval
;;configuration when invoked to evaluate a line."
;; (interactive)
;; (let ((eir-jump-after-eval (not eir-jump-after-eval)))
;; (eir-eval-in-shell)))
;;(add-hook 'sh-mode-hook
;; '(lambda()
;; (local-set-key (kbd "C-M-") 'eir-eval-in-shell2)))
;;--------------------------------------------------------------;;

js-comint `wrong-number-of-arguments` error

Hello,

The error is occurring part way through the code submitted. It's a JS function, and the first line that appears in the backtrace is the fifth line of the code itself. I plugged the code into node by hand to confirm it is correct, nothing hinky there. The code is being run in an org-mode source block.

Debugger entered--Lisp error: (wrong-number-of-arguments #<subr js-comint-start-or-switch-to-repl> 1)     switch-to-js(t)
#f(compiled-function () #<bytecode 0x1e820db659a472>)() eir-send-to-repl(#f(compiled-function () #<bytecode   
0x1e820db659a472>)
comint-send-input " const codeEnd = Math.ceil(Math.random()*factor);")
apply(eir-send-to-repl (#f(compiled-function () #<bytecode 0x1e820db659a472>) comint-send-input " const codeEnd =   
Math.ceil(Math.random()*factor);")) eir-send-to-javascript("  const codeEnd = Math.ceil(Math.random()*factor);")
eir-eval-in-javascript() ober-eval-in-repl()
funcall-interactively(ober-eval-in-repl)
command-execute(ober-eval-in-repl)

GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2021-10-12
org-mode version 9.5
Windows 10 Pro

add support for JavaScript

there is a package called js-comint can do inferior-js-mode and run-js.
Hope you can support JavaScript.

Supress split buffer when running C-<return>

Hi,
I'm playing around with the python eval-in-repl and was wondering if there is a possibility to configure it so that when you press the key combo C- the line is sent but if you don't have the inferor mode buffer open the the buffer configuration will just stay as it is.
I usually have the buffers as I want them and this is changing that somewhat.

eval-in-repl-ruby error

When I execute M-x eir-eval-in-ruby in a ruby buffer with an inf-ruby mode, it gives the following error.

eir-send-to-repl: Wrong number of arguments: (lambda (command &optional name) "Run an inferior Ruby process, input and output in a new buffer.

The consecutive buffer names will be:
`*NAME*', `*NAME*<2>', `*NAME*<3>' and so on.

NAME defaults to \"ruby\".

Runs the hooks `comint-mode-hook' and `inf-ruby-mode-hook'.

(Type \\[describe-mode] in the process buffer for the list of commands.)" (setq name (or name "ruby")) (let ((commandlist (split-string-and-unquote command)) (buffer (current-buffer)) (process-environment process-environment)) (setenv "PAGER" (executable-find "cat")) (set-buffer (apply (quote make-comint-in-buffer) name (generate-new-buffer-name (format "*%s*" name)) (car commandlist) nil (cdr commandlist))) (inf-ruby-mode) (ruby-remember-ruby-buffer buffer) (setq inf-ruby-buffers (cons (current-buffer) inf-ruby-buffers)) (setq inf-ruby-buffer-impl-name name inf-ruby-buffer-command command)) (pop-to-buffer (setq inf-ruby-buffer (current-buffer)))), 0

However, M-x ruby-send-region works correctly.
Has there been an incompatible update recently?

Sorry to bother, but it would be awesome if you could look into this (I will try to fix this after the new years when I get the time).

send word at cursor to REPL

I want to improve my Python workflow in the following way:

  • Send word at cursor to REPL
  • Send word.info() from word (variable) at cursor to REPL
  • Send type(word) from word (variable) at cursor to REPL

I do the following with Elpy but since I use spacemacs I'd rather not use it since it is big.

(defun jv-python/elpy-shell-send-word ()
  "Send word at cursor."
  (interactive)
  (elpy-shell--ensure-shell-running)
  (when (not elpy-shell-echo-input) (elpy-shell--append-to-shell-output "\n"))
    (elpy-shell--with-maybe-echo
  (python-shell-send-string (thing-at-point 'symbol)))
  )

Can someone please help me with the points above using spacemacs + eir?

Byte-compile warnings

Hi,

Thanks for this nice package. FYI, there are many byte-compile warnings when installing this package, if you don't have all of the supported modes installed:

Leaving directory `/home/me/.emacs.d/elpa/eval-in-repl-20160418.1843'

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-cider.el at Tue Nov  8 01:57:03 2016
Entering directory `/home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/'
eval-in-repl-cider.el:36:1:Error: Cannot open load file: no such file or directory, cider

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-geiser.el at Tue Nov  8 01:57:03 2016
eval-in-repl-geiser.el:36:1:Error: Cannot open load file: no such file or directory, geiser-mode

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-hy.el at Tue Nov  8 01:57:03 2016

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-ielm.el at Tue Nov  8 01:57:03 2016

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-javascript.el at Tue Nov  8 01:57:04 2016
eval-in-repl-javascript.el:37:1:Error: Cannot open load file: no such file or directory, js3-mode

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-ocaml.el at Tue Nov  8 01:57:04 2016
eval-in-repl-ocaml.el:36:1:Error: Cannot open load file: no such file or directory, tuareg

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-prolog.el at Tue Nov  8 01:57:04 2016

In end of data:
eval-in-repl-prolog.el:87:1:Warning: the function `prolog-consult-region' is
    not known to be defined.

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-python.el at Tue Nov  8 01:57:04 2016

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-racket.el at Tue Nov  8 01:57:04 2016
eval-in-repl-racket.el:36:1:Error: Cannot open load file: no such file or directory, racket-mode

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-ruby.el at Tue Nov  8 01:57:04 2016
eval-in-repl-ruby.el:37:1:Error: Cannot open load file: no such file or directory, inf-ruby

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-scheme.el at Tue Nov  8 01:57:04 2016

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-shell.el at Tue Nov  8 01:57:04 2016

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-slime.el at Tue Nov  8 01:57:05 2016
eval-in-repl-slime.el:36:1:Error: Cannot open load file: no such file or directory, slime

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl-sml.el at Tue Nov  8 01:57:05 2016
eval-in-repl-sml.el:36:1:Error: Cannot open load file: no such file or directory, sml-mode

Compiling file /home/me/.emacs.d/elpa/eval-in-repl-20160418.1843/eval-in-repl.el at Tue Nov  8 01:57:05 2016
eval-in-repl.el:136:1:Warning: Unused lexical variable `name-repl-buffer'
eval-in-repl.el:136:1:Warning: Unused lexical variable `name-script-buffer'

Allow passing arguments downstream eval-in-repl

It would be handy to have a fully transparent eir-eval-in-repl-lisp facade.

For example, we could pass arguments to it that would go directly downstream to the correct "implementation" (-cider, ...).
Another use case, in lisp I am often instrumenting edebug according to the following:

With a prefix argument, C-M-x instruments the function definition for Edebug, the Emacs Lisp Debugger. See Instrumenting for Edebug in the Emacs Lisp Reference Manual. 

Do you think it would be hard to accomplish?

Suggestion: Make eir-jump-after-eval buffer local

Suggestion

Why don't we make eir-jump-after-eval a buffer local variable?

Because whether we want to move lines after evaluation depends on our workflow, and the workflows can differ among the languages. It would be great if we can toggle this setting according to the language we are in, or based on some other condition.

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.