Two questions:
Where does the result of
eval-buffer
get stored? How do I access it?
For example:(+ 2 2)
Functions like
(forward-word)
are executed byeval-buffer
, but do not move the cursor? Why is that?
Two questions:
Where does the result of eval-buffer
get stored? How do I access it?
For example:
(+ 2 2)
Functions like (forward-word)
are executed by eval-buffer
, but do not move the cursor? Why is that?
eval-buffer
is usually used for side-effects, rather than return value. For example, in your .emacs file, eval-buffer
will re-load all our config settings. By default, and when used interactively, it will always return 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 C-x C-e
, is one way to do so. Calling it with a prefix, C-u C-x C-e
will insert the return value into the current buffer.
eval-buffer
preserves the value of point. So functions like forward-word
will have no visible effect.