0

How can one run a command (e.g. to open a file) in an existing emacsclient instance, from the terminal (i.e. not from Emacs itself)?

  • Is "open a file" the best example for your question? That's pretty much the purpose of emacsclient <file> after all. I expect you're looking for the --eval option. – phils Jun 8 at 21:45
  • The OP says "in an existing emacsclient instance", so I suspect command line options are not what is required. But if I understand that requirement correctly, it is quite fuzzy; what does an "existing emacslient instance" really mean? Once emacsclient connects to emacs and emacs does the requested action, the emacsclient process exists only for the sole purpose of getting notified when emacs is done with the client buffer. All the data is really within emacs. – q.undertow Jun 8 at 22:43
  • Emacsclient can do nothing but talking to Emacs, for example, you can replace Emacsclient with netcat via echo '-eval emacs-version' | nc -U $TMPDIR/emacs$(id -u)/server. – xuchunyang Jun 9 at 3:17

Your Answer

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

Browse other questions tagged or ask your own question.