nrepl.el: how to eval clojure buffer form to nrepl buffer instead of echo area?

后端 未结 3 2034
粉色の甜心
粉色の甜心 2021-02-05 20:51

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,

3条回答
  •  情书的邮戳
    2021-02-05 21:15

    Since none of the solutions provided here work with the version I have, I came up with my own implementation:

    (defun eval-in-nrepl ()
      (interactive)
      (let ((exp (nrepl-last-expression)))
        (with-current-buffer (nrepl-current-repl-buffer)
          (nrepl-replace-input exp)
          (nrepl-return))))
    
    (eval-after-load 'nrepl
      '(define-key nrepl-interaction-mode-map
         (kbd "C-x C-.")
         'eval-in-nrepl))
    

    It binds C-x C-. to the desired behavior.

提交回复
热议问题