nrepl.el:如何评估clojure缓冲区形式到nrepl缓冲区而不是回波区? [英] nrepl.el: how to eval clojure buffer form to nrepl buffer instead of echo area?

查看:122
本文介绍了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缓冲区而不是回波区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆