DamienCassou/auth-password-store@468bba2 -> DamienCassou/auth-password-store@fa8b964 Silex/docker.el@ed0cdf0 -> Silex/docker.el@bc2dc09 cjohansson/emacs-ssh-deploy@cc91b56 -> cjohansson/emacs-ssh-deploy@fce4ea3 editorconfig/editorconfig-emacs@9da2dab -> editorconfig/editorconfig-emacs@e10fa22 emacs-lsp/dap-mode@49af1b8 -> emacs-lsp/dap-mode@4347846 emacs-lsp/lsp-ivy@4dcb635 -> emacs-lsp/lsp-ivy@bccd860 emacs-lsp/lsp-mode@3dc87f6 -> emacs-lsp/lsp-mode@aec8968 emacs-lsp/lsp-ui@efae00e -> emacs-lsp/lsp-ui@cb02972 emacsorphanage/quickrun@57db985 -> emacsorphanage/quickrun@35e91f4 jacktasia/dumb-jump@8bc1950 -> jacktasia/dumb-jump@8f70acb joaotavora/eglot@b06589b -> joaotavora/eglot@a5b7b7d magit/forge@f4c95dd -> magit/forge@37aa4e4 magit/magit@577f16d -> magit/magit@e378827 millejoh/emacs-ipython-notebook@142ff50 -> millejoh/emacs-ipython-notebook@09af858 purcell/envrc@110a221 -> purcell/envrc@8a9a142 realgud/realgud@34557f8 -> realgud/realgud@7a70b27 spotify/dockerfile-mode@3b13745 -> spotify/dockerfile-mode@ad06a41 tkf/emacs-request@accd430 -> tkf/emacs-request@f3a5b43 tmalsburg/helm-bibtex@ca09076 -> tmalsburg/helm-bibtex@9f6ea92 vedang/pdf-tools@35e12b0 -> vedang/pdf-tools@d262cf9 yoshiki/yaml-mode@fc5e1c5 -> yoshiki/yaml-mode@3a57058 zx2c4/password-store@918992c -> zx2c4/password-store@4e73cdc
tools/eval
Description
This modules adds inline code evaluation support to Emacs and a universal interface for opening and interacting with REPLs.
Module Flags
+overlay
Enables the use of overlays (near the cursor) to display the result of inline code evaluation (rather than the minibuffer). That is, unless the results are too big, in which case it will still fall back to popup buffers.
Plugins
Hacks
-
Quickrun has been modified to:
- Use only one output window, in case of consecutive execution of code.
- The quickrun window will resize itself to fit its output, once the underlying process is finished executing the code.
Prerequisites
This module has no direct prerequisites.
However, many languages will require that you install their interpreters, code
runners and/or repls to power the functionality of this module. Visit the
documentation of their respective :lang
module for instructions.
Features
Inline Code Evaluation
Quickrun can be invoked via:
M-x +eval/buffer
(orgR
, orM-r
)M-x +eval/region
M-x +eval/region-and-replace
- Evil users can use the
gr
operator to select and run a region.
REPLs
Invoked via:
SPC o r
or:repl
will open a REPL in a popup window.SPC o R
or:repl!
will open a REPL in the current window. If a REPL is already open and a selection is active, it will be sent to the REPL.M-x +eval/open-repl-other-window
(SPC o r
)M-x +eval/open-repl-same-window
(SPC o R
)M-x +eval/send-region-to-repl
(SPC c s
) while a selection (and REPL) is active
Configuration
Register a REPL for a major-mode
REPLs are defined for most languages Doom supports. Check that language module's README.org to see if it does (and if it requires additional setup).
To use them, you may use M-x +eval/open-repl-other-window
, M-x
+eval/open-repl-same-window
, :repl
(for evil users) or the default binding:
SPC o r
. These will open a REPL in a popup window.
You can simply call that mode's REPL command manually. e.g.
M-x ielm
, but this will bar you from the benefits of Doom's REPL system (like send-to-repl functionality).
Otherwise, you can define your own for a specified major mode:
(set-repl-handler! MAJOR-MODES FUNCTION)
MAJOR-MODES is a single major mode symbol or a list of them.
FUNCTION should return a repl buffer. Any window changes in this function are ignored, then the REPL is opened in a popup window.
(defun +lua/open-repl ()
(interactive)
(lua-start-process "lua" "lua")
(pop-to-buffer lua-process-buffer))
(set-repl-handler! 'lua-mode #'+lua/open-repl)
Change how code is evaluated in a major mode
Run regions or entire buffers with Quickrun. Output is show in a popup window.
Quickrun includes support for many languages, usually by sending text directly to interpreters or compilers. However, occasionally, you'll find a language without support (like Crystal), or a language with better Emacs integration (like elisp).
Here's how you define a "runner":
(set-eval-handler! 'crystal-mode
'((:command . "crystal")
(:exec . "%c %s")
(:description . "Run Crystal script")))
A simpler version is simply to use the path to the binary:
(set-eval-handler! 'groovy-mode "groovy")
Or if you'd rather run an elisp command:
(set-eval-handler! 'emacs-lisp-mode #'+emacs-lisp-eval)