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)?
Asked
Active
Viewed 250 times
0
-
Is "open a file" the best example for your question? That's pretty much the purpose of `emacsclient
` after all. I expect you're looking for the `--eval` option. – phils Jun 08 '20 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 08 '20 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 09 '20 at 03:17
-
I suspect this is a duplicate of: https://emacs.stackexchange.com/questions/25033/run-elisp-from-command-line-in-running-emacs – Lorem Ipsum Mar 18 '21 at 14:46