I\'m a newbie to emacs. I\'m working with emacs-24.1 on redhat linux, and trying to evaluate an elisp expression. What I want emacs to do is to evaluate the elisp expression wit
Try
emacs --batch --eval '(print (+ 2 3))'
After a bit of testing it looks like you can use --batch
to have emacs dump any messages to stderr. Then you can call message
to print things to stderr where you'll be able to see them. Your example would become emacs --batch --eval '(message (number-to-string (+ 2 3)))'
and the result would be printed to stderr.
If you're trying to redirect the output to a file you'll need to redirect stderr instead of stdout by using 2>
instead of just >
.