【问题标题】:How to evaluate a buffer and print everything into another?如何评估缓冲区并将所有内容打印到另一个缓冲区中?
【发布时间】:2020-12-29 12:50:44
【问题描述】:

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

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

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

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

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

【问题讨论】:

    标签: printing emacs eval


    【解决方案1】:

    这使得 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-13
      • 2015-12-04
      • 1970-01-01
      • 1970-01-01
      • 2013-05-20
      • 2014-05-30
      • 2012-10-17
      相关资源
      最近更新 更多