doomemacs / doomemacs/core

eval: allow send-region-to-repl to work with a terminal buffer

Open
#2,496 2 comments 0 reactions 0 assignees View on GitHub
:term eshell :term shell :term term :term vterm :tools eval is:feature
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

**Describe the feature**
I am requesting the feature that the `+eval/send-region-to-buffer` would send text to a program running in a terminal buffer. In my use case, a repl-handler is set up for sql, which is to run `snowsql` inside a terminal buffer. The repl handler code is as follows:

```lisp
(defun +snowflake/open-repl ()
"Runs snowsql in a `term' buffer."
(interactive)
(require 'term)
(let ((termbuf (apply 'make-term "snowflake" "snowsql" nil)))
(set-buffer termbuf)
(term-mode)
(term-char-mode)
termbuf))

(set-repl-handler! 'sql-mode #'+snowflake/open-repl)
```

What I would like to have is to use the `gr` keybinding in the doom eval framework to send code to the buffer. It does not work since `+eval/send-region-to-repl` use `insert` to paste text to the repl buffer. For the term buffer, `term-send-raw-string` is expected.

Further, I wonder whether it is possible that the eval framework allows each repl handler to provide their own version of send-text function, given each repl has their own underlying implementation?

**System information**

emacs   version    26.3

features XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2
build Dec 07, 2019
buildopts (--with-modules --prefix=/usr/local)
windowsys nil
daemonp nil
doom version 2.0.9
build HEAD -> develop, origin/develop, origin/HEAD 453e20534 2020-01-15 11:19:32 -0500
dir ~/02-computing/linux/dotfiles/doom.d/
system type gnu/linux
config x86_64-pc-linux-gnu
shell /bin/zsh
uname Linux 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64
path (/usr/local/bin /usr/local/sbin /usr/bin /bin /usr/games /usr/lib/surfraw ~/.fzf/bin ~/02-computing/linux/bin ~/bin ~/.local/bin ~/.emacs.d/bin /usr/local/libexec/emacs/26.3/x86_64-pc-linux-gnu)
config envfile nil
elc-files 0
modules (:completion company (ivy +fuzzy) :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold (format +onsave) multiple-cursors rotate-text snippets :emacs dired electric ibuffer vc :term shell term :checkers syntax spell :tools (eval +overlay) (lookup +docsets) lsp magit pass :lang clojure data emacs-lisp ess markdown (org +dragndrop +jupyter +pandoc +pomodoro +present) (python +lsp) sh :config (default +bindings +smartparens))
packages (fzf evil-terminal-cursor-changer command-log-mode (jupyter :pin "9e3c1633586982e278f072dfaaabd115fa4d19f7") (lsp-python-ms :pin "83ef84d9a4a942f8882b00d07bb78b15f716e89d") visual-basic-mode sql-indent)
elpa (n/a)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.