如何评估缓冲区并将所有内容打印到另一个缓冲区?

问题描述

我已经为此搜索了几个小时,但我已经放弃了。也许你能帮上忙。

我想要做的就是评估缓冲区中的 LISP 并查看打印的所有内容。例如这里:

(setq NUMBERS (list 1 2 3))
(add-to-list 'NUMBERS 4 t)
(print NUMBERS)
@H_404_7@

所以我做了 M-x eval-buffer 并且我没有看到数字打印出来。 (当使用 M-x M-e 时不会发生一些事情,但我不想对每一行都这样做,我也不想每次都标记该区域。我只想评估整个缓冲区)。我查看了 eval-buffer 的描述,看到有一个打印参数,但我不能给它任何值,因为我不知道在那里实际输入什么。 “打印”也许?但是 (universal-argument) 只提供数值,所以我迷路了。

基本问题:如何评估整个缓冲区并实际查看打印的内容

解决方法

这使我在 Emacs 27.1 中的回显区域中出现输出:

(print NUMBERS t)

即使文档说:

Optional argument PRINTCHARFUN is the output stream,which can be one
of these:

   - a buffer,in which case output is inserted into that buffer at point;
   - a marker,in which case output is inserted at marker’s position;
   - a function,in which case that function is called once for each
     character of OBJECT’s printed representation;
   - a symbol,in which case that symbol’s function definition is called; or
   - t,in which case the output is displayed in the echo area.

If PRINTCHARFUN is omitted,the value of ‘standard-output’ (which see)
is used instead.

standard-output 是:

Its value is t