[英]How do I access the result of eval-buffer?
Two questions: 两个问题:
Where does the result of eval-buffer
get stored? eval-buffer
的结果存储在哪里? How do I access it? 我该如何访问它?
For example: 例如:
(+ 2 2)
Functions like (forward-word)
are executed by eval-buffer
, but do not move the cursor? 像(forward-word)
这样的eval-buffer
是由eval-buffer
执行的,但是不要移动光标? Why is that? 这是为什么?
eval-buffer
is usually used for side-effects, rather than return value. eval-buffer
通常用于副作用,而不是返回值。 For example, in your .emacs file, eval-buffer
will re-load all our config settings. 例如,在.emacs文件中, eval-buffer
将重新加载所有配置设置。 By default, and when used interactively, it will always return nil
. 默认情况下,当以交互方式使用时,它将始终返回nil
。 If you want to get the return value of code in a buffer, this is the wrong way to do it. 如果要在缓冲区中获取代码的返回值,这是错误的方法。 eval-last-sexp
, bound to Cx Ce
, is one way to do so. eval-last-sexp
,绑定到Cx Ce
,是这样做的一种方法。 Calling it with a prefix, Cu Cx Ce
will insert the return value into the current buffer. 使用前缀调用它, Cu Cx Ce
会将返回值插入当前缓冲区。
eval-buffer
preserves the value of point. eval-buffer
保留point的值。 So functions like forward-word
will have no visible effect. 因此像forward-word
这样的函数没有明显的效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.