Files
doomemacs/modules/tools/eval
Henrik Lissner 79a8abd85a bump: :tools
Silex/docker.el@813c00410b -> Silex/docker.el@46b597a711
editorconfig/editorconfig-emacs@24f5b2b1cd -> editorconfig/editorconfig-emacs@1a9942746c
emacs-ansible/emacs-ansible@03e285bb54 -> emacs-ansible/emacs-ansible@4601ff31f5
emacs-citar/citar@2826996799 -> emacs-citar/citar@ce5e9644ed
emacs-lsp/dap-mode@ffb7957612 -> emacs-lsp/dap-mode@09dc16bae1
emacs-lsp/lsp-mode@d28dd6b7e3 -> emacs-lsp/lsp-mode@b383e637dc
emacs-lsp/lsp-ui@f0edfac7b3 -> emacs-lsp/lsp-ui@00e69463b4
emacs-straight/eglot@d3e44d33b7 -> emacs-straight/eglot@2d5d494bfc
emacs-tree-sitter/elisp-tree-sitter@fe98d0cae7 -> emacs-tree-sitter/elisp-tree-sitter@f3b6e78cd4
emacs-tree-sitter/tree-sitter-langs@4f951dbb53 -> emacs-tree-sitter/tree-sitter-langs@2ff446b4b8
emacsorphanage/quickrun@d383929c50 -> emacsorphanage/quickrun@7345432cea
gagbo/consult-lsp@6858391316 -> gagbo/consult-lsp@aef321d039
hpdeifel/synosaurus@14d34fc92a -> hpdeifel/synosaurus@690755ce88
jacktasia/dumb-jump@cd65a74337 -> jacktasia/dumb-jump@93665381d9
joostkremers/parsebib@f0e57a3606 -> joostkremers/parsebib@a25621930e
magit/forge@0c90606262 -> magit/forge@33e240d360
magit/magit@7dfebba55b -> magit/magit@f52dfada8f
mohkale/consult-eglot@9b490eb384 -> mohkale/consult-eglot@b71499f4b9
nicolaisingh/saveplace-pdf-view@70e9ec4056 -> nicolaisingh/saveplace-pdf-view@79e76562bc
purcell/envrc@60f5091538 -> purcell/envrc@2b818ca6e4
rejeep/prodigy.el@c5a17c280d -> rejeep/prodigy.el@99908d13be
tkf/emacs-request@01e338c335 -> tkf/emacs-request@c22e3c23a6
tumashu/posframe@8165153682 -> tumashu/posframe@12f540c9ad
2025-02-21 15:17:42 -05:00
..
2024-09-14 20:47:39 -04:00
2025-02-21 15:17:42 -05:00

:tools eval

Description   unfold

This modules adds inline code evaluation support to Emacs and a universal interface for opening and interacting with REPLs.

Maintainers

This module has no dedicated maintainers. Become a maintainer?

Module flags

+overlay
Enable the use of overlays (near the cursor) to display the result of inline code evaluation (rather than the minibuffer). If the results are too big the minibuffer will be used anyway.

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.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

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 doom-module::lang module for instructions.

TODO Usage

󱌣 This module's usage documentation is incomplete. Complete it?

Inline Code Evaluation

Quickrun can be invoked via:

  • M-x +eval/buffer (or gR, or M-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

TODO Configuration

󱌣 This module's configuration documentation is incomplete. Complete it?

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. E.g.

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

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

TODO Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?