logoalt Hacker News

SoftTalkertoday at 2:51 PM3 repliesview on HN

Emacs itself can run as a client and server. To start the server:

  emacs --daemon
Then use `emacsclient` to connect to it. All `emacsclient` instances whether in terminals or GUI are using the same server and can access the same open files and buffers.

Unfortunately it only works locally. I've tried to forward the emacs server socket over ssh to a remote client and it doesn't work.


Replies

kickingvegastoday at 6:04 PM

In retrospect, the name `emacsclient` was a poor one because in 2026 most folks new to Emacs expect it to act like a REST client, where runtime state is synchronized between the client and server over a network. Emacs' usage of ‘client’ and ‘server’ here refer to the usage of a Unix local domain (i.e. file system) socket for simple control commands from the socket client. This was later extended to support a network socket, but the client still only sends simple control commands.

MarsIronPItoday at 5:39 PM

Forwarding the socket doesn't work, but if you use X11 then you can use `ssh -X`, and the remote Emacs will open a frame on your local X server.

Do beware though that if you use the non-PGTK GTK build, closing this new frame will crash the remote Emacs.

show 1 reply
rozularentoday at 2:53 PM

could you see the reason it didn't work?

show 1 reply