Function: eval-last-sexp
eval-last-sexp is an interactive and byte-compiled function defined in
elisp-mode.el.gz.
Signature
(eval-last-sexp EVAL-LAST-SEXP-ARG-INTERNAL)
Documentation
Evaluate sexp before point; print value in the echo area.
Interactively, with a non - prefix argument, print output into
current buffer.
This commands handles defvar, defcustom and defface the
same way that eval-defun does. See the doc string of that
function for details.
Normally, this function truncates long output according to the
value of the variables eval-expression-print-length and
eval-expression-print-level. With a prefix argument of zero,
however, there is no such truncation.
Integer values are printed in several formats (decimal, octal,
and hexadecimal). When the prefix argument is -1 or the value
doesn't exceed eval-expression-print-maximum-character, an
integer value is also printed as a character of that codepoint.
If eval-expression-debug-on-error is non-nil, which is the default,
this command arranges for all errors to enter the debugger.
Probably introduced at or before Emacs version 24.4.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun eval-last-sexp (eval-last-sexp-arg-internal)
"Evaluate sexp before point; print value in the echo area.
Interactively, with a non `-' prefix argument, print output into
current buffer.
This commands handles `defvar', `defcustom' and `defface' the
same way that `eval-defun' does. See the doc string of that
function for details.
Normally, this function truncates long output according to the
value of the variables `eval-expression-print-length' and
`eval-expression-print-level'. With a prefix argument of zero,
however, there is no such truncation.
Integer values are printed in several formats (decimal, octal,
and hexadecimal). When the prefix argument is -1 or the value
doesn't exceed `eval-expression-print-maximum-character', an
integer value is also printed as a character of that codepoint.
If `eval-expression-debug-on-error' is non-nil, which is the default,
this command arranges for all errors to enter the debugger."
(interactive "P")
(if (null eval-expression-debug-on-error)
(values--store-value
(elisp--eval-last-sexp eval-last-sexp-arg-internal))
(let ((value
(let ((debug-on-error elisp--eval-last-sexp-fake-value))
(cons (elisp--eval-last-sexp eval-last-sexp-arg-internal)
debug-on-error))))
(unless (eq (cdr value) elisp--eval-last-sexp-fake-value)
(setq debug-on-error (cdr value)))
(car value))))