nrepl.el:如何评估clojure缓冲区形式到nrepl缓冲区而不是回波区?

编程入门 行业动态 更新时间:2024-10-15 22:30:16
本文介绍了nrepl.el:如何评估clojure缓冲区形式到nrepl缓冲区而不是回波区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我从git(0.1.6预览,通过el-get食谱)使用nrepl.el,我想clojure缓冲区evals:Cx Ce,CMx,Cc Cr形式,顶级形式和区域分别将自己发送到nrepl缓冲区并在那里进行评估,而不是使用返回到回显区域的结果评估屏幕的默认行为。

有任何方式

感谢。

div

但是好消息是你在这里在emacs-land中,因此应该可以编写自己的自定义处理程序,将输出定向到nrepl缓冲区,并根据需要调整键绑定。

例如,这相当于Cx Ce,但将评估结果发送到repl缓冲区而不是minibuffer:

defun my-interactive-eval-to-repl(form)(let((buffer nrepl-nrepl-buffer))(nrepl-send-string form(nrepl-handler buffer)nrepl-buffer- ns))) (defun my-eval-last-expression-to-repl()(interactive)(my-interactive-eval-to-repl -last-expression)))

I'm using nrepl.el from git (0.1.6-preview, via el-get recipe), and I would like clojure buffer evals: C-x C-e, C-M-x, C-c C-r for form, top-level form and region respectively, to send themselves to the nrepl buffer and evaluate there, rather than the default behavior of evaluating off-screen with results returned to the echo area.

Is there any way to do this, or is there another set of keybindings for this purpose that I'm not recognizing by their descriptions?

Thanks.

解决方案

The behavior you described is not presently supported in nrepl.el.

But the good news is you are in emacs-land, so it should be possible to write your own custom handler to direct the output to the nrepl buffer and adjust your key bindings if you like.

For example, this is the equivalent of C-x C-e but sends the result of the evaluation to the repl buffer instead of the minibuffer:

(defun my-interactive-eval-to-repl (form) (let ((buffer nrepl-nrepl-buffer)) (nrepl-send-string form (nrepl-handler buffer) nrepl-buffer-ns))) (defun my-eval-last-expression-to-repl () (interactive) (my-interactive-eval-to-repl (nrepl-last-expression)))

更多推荐

nrepl.el:如何评估clojure缓冲区形式到nrepl缓冲区而不是回波区?

本文发布于:2023-07-18 03:43:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1140647.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓冲区   回波   而不是   形式   nrepl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!