In emacs, when I evaluate an elisp function, I get the value plus other stuff.
For example, if I evaluate (+ 2 2), I get this:
4 (#04, #x4, ?\C-d)
How can I setup emacs to just return 4
?
It prints out that extra information as an aid to the user when you evaluate expressions interactively, but they’re not actually part of the return value of the expression itself. What are you actually trying to accomplish?
Edit: Ok, so you just regard it as distracting. Did you try reading the help for eval-expression
? You can get the help for a function with C-h f
, but I will duplicate it here:
Evaluate EXP and print value in the echo area.
When called interactively, read an Emacs Lisp expression and
evaluate it. Value is also consed on to front of the variable
values. Optional argument INSERT-VALUE non-nil (interactively,
with a non - prefix argument) means insert the result into the
current buffer instead of printing it in the echo area.
Normally, this function truncates long output according to the
value of the variables eval-expression-print-length and
eval-expression-print-level. When NO-TRUNCATE is
non-nil (interactively, with a prefix argument of zero), however,
there is no such truncation.
If the resulting value is an integer, and CHAR-PRINT-LIMIT is
non-nil (interactively, unless given a non-zero prefix argument)
it will be printed in several additional formats (octal,
hexadecimal, and character). The character format is used only
if the value is below CHAR-PRINT-LIMIT (interactively, if the
prefix argument is -1 or the value doesn't exceed
eval-expression-print-maximum-character).
Runs the hook eval-expression-minibuffer-setup-hook on entering the
minibuffer.
If eval-expression-debug-on-error is non-nil, which is the default,
this command arranges for all errors to enter the debugger.
As you can see, you can control this behavior either by specifying a prefix argument (with C-u
as usual) or by customizing eval-expression-print-maximum-character
.
emacs -Q