2

我意识到 SLIME 是高级 Lisp 交互模式,但我想知道是否有一个“Lisp 交互”缓冲区可以与 Common Lisp 一起使用,例如 *scratch* 缓冲区可以与 Emacs Lisp 一起使用。IE 在表单末尾点击 Cj 会将表单的结果插入到当前缓冲区中。

我问是因为我发现根据需要编辑输出比使用 repl 更容易。

4

2 回答 2

4

虽然M-xslime-scratchRET我不知道C-j默认情况下会做什么,因为我使用 Paredit

但是,在和C-uC-xC-e中都可以满足您的要求。*scratch**slime-scratch*

It is bound to C-x C-e.

(eval-last-sexp EVAL-LAST-SEXP-ARG-INTERNAL)

Evaluate sexp before point; print value in minibuffer.
Interactively, with prefix argument, print output into current buffer.
Truncates long output according to the value of the variables
`eval-expression-print-length' and `eval-expression-print-level'.

(它slime-eval-last-expression*slime-scratch*缓冲区中)

于 2012-07-05T05:52:29.117 回答
1

将此函数绑定到 Cj 会执行我正在寻找的行为:

(defun slime-eval-print-last-sexp ()
  (interactive)
  (newline)
  (insert (cadr (slime-eval `(swank:eval-and-grab-output ,(slime-last-expression)))))
  (newline))
于 2012-07-05T03:54:05.220 回答