doomemacs/modules/tools/eval
Henrik Lissner 1a05e2fa64
bump: :tools
NicolasPetton/pass@c721604b3b -> NicolasPetton/pass@ed7031c5c3
Silex/docker.el@6997c86a24 -> Silex/docker.el@d5255a65b7
alphapapa/magit-todos@cadf29d1cc -> alphapapa/magit-todos@debb77b358
andras-simonyi/citeproc-el@290320fc57 -> andras-simonyi/citeproc-el@c61c98b9d2
doomelpa/code-review@26f426e992 -> doomelpa/code-review@c34ff1ee64
editorconfig/editorconfig-emacs@2fed9599bc -> editorconfig/editorconfig-emacs@4b81a59928
emacs-citar/citar-org-roam@761eed6678 -> emacs-citar/citar-org-roam@7d67dccf80
emacs-citar/citar@2c0547db57 -> emacs-citar/citar@885b86f673
emacs-lsp/lsp-mode@02c5ba59ce -> emacs-lsp/lsp-mode@fb88cc6b8b
emacs-straight/eglot@f73594f589 -> emacs-straight/eglot@cd4e45b700
emacs-straight/rainbow-mode@24437ec2c6 -> emacs-straight/rainbow-mode@70ed10d410
emacs-tree-sitter/tree-sitter-langs@5eb24557f5 -> emacs-tree-sitter/tree-sitter-langs@20fbbb8573
emacsorphanage/quickrun@6f96318930 -> emacsorphanage/quickrun@248149b026
hcl-emacs/terraform-mode@39d2fd5bfc -> hcl-emacs/terraform-mode@e8b57df8c2
jacktasia/dumb-jump@d9503c157a -> jacktasia/dumb-jump@ede6a04187
magit/forge@ba35ffc9ba -> magit/forge@b16b6ec4f7
magit/magit@4881835572 -> magit/magit@54d37dc14c
meain/evil-textobj-tree-sitter@9a9edd42a2 -> meain/evil-textobj-tree-sitter@220ceae065
purcell/envrc@33d01388ce -> purcell/envrc@1385e72a73
rejeep/prodigy.el@a3be00d3b9 -> rejeep/prodigy.el@cc68fa9d60
tmalsburg/helm-bibtex@ef07adfeda -> tmalsburg/helm-bibtex@bf184cc311
xuchunyang/osx-dictionary.el@0715e5a3ac -> xuchunyang/osx-dictionary.el@1f5a74f3e5
yoshiki/yaml-mode@3fcb36d603 -> yoshiki/yaml-mode@5b58248ab2
zx2c4/password-store@28cec11f1d -> zx2c4/password-store@b5e965a838
2024-02-04 19:07:25 -05:00
..
autoload feat(tools): rework REPL selection UI 2023-03-08 20:31:25 -05:00
config.el refactor: deprecate featurep! for modulep! 2022-08-14 20:43:35 +02:00
packages.el bump: :tools 2024-02-04 19:07:25 -05:00
README.org docs(*): replace all-the-icons with nerd-icons 2023-09-16 20:19:11 +02: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?