5

When I evaluate an expression with C-x C-e, I see the result returned by that expression in the minibuffer, for a while.

Can I have that returned value written in the same buffer where the evalued expression is?

How?

user1632812
  • 155
  • 3
  • 2
    I removed your `buffer-local` tag. `buffer-local` in emacs is about variables having values specific to a buffer. – rpluim Dec 20 '20 at 12:37

1 Answers1

7

The emacs way is to ask emacs:

C-h k C-x C-e

C-x C-e runs the command eval-last-sexp (found in global-map), which
is an interactive compiled Lisp function in `elisp-mode.el'.

It is bound to C-x C-e.

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

  Probably introduced at or before Emacs version 24.4.

Evaluate sexp before point; print value in the echo area.
Interactively, with a non `-' prefix argument, print output into
current buffer.

Read that last line. Do:

C-u C-x C-e

and observe the result.

Drew
  • 75,699
  • 9
  • 109
  • 225
rpluim
  • 4,605
  • 8
  • 22