Just a quick question,

Can emacsclient evaluate/run Elisp code from a given file, or even better, from stdin?

  • Don't have a clue where to start really. – Wudong Nov 26 '17 at 17:54

Emacsclient has the --eval (same as -e) option, so

emacsclient --eval '(load "my-file.el")'

will read and evaluate the file "my-file.el".

I don't think Emacs has access to the emacsclient's stdin, but you can do something like

cat <<EOF > my-file.el

and let user enter the lisp form terminated by EOF on a otherwise blank like, then pass "my-file.el" to load and remove the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.