I’m interested to know what the future of remove development with emacs might look like. I’m a long time emacs user, and use rust, lsp-mode, magit and projectile heavily. The remote experience with tramp just isn’t very good. I’ve had to work around several bugs that lead to hangs, and even though I’m only ~20millis away from my remote machine performance is pretty bad. I believe I’ve already done everything I can to make it fast (ssh control master, etc.), and I’m still not happy. On the other hand, VSCode (which I’m not familiar with) or IntelliJ make remote development a breeze. I really like how they hide latency, and handle reconnects well. I’ve also tried terminal emacs on the remote machine, but I just can’t deal with the input lag.
It’s remarkable how emacs has been able to adapt over the years, and so I’m interested to hear about some ideas to keep emacs relevant for this usecase.
On the server. You just ssh -X, and call emacs. You can also use emacsclient on the server and then (also on the server) connect to it with the graphical client. This helps when you want to prevent connection los to break your process running. Or emacs -nw also works. There are no special commands used.
I may have a few tweaks I can check tomorrow at my work machine, but mine was never that bad. I find the diff is slow and can freeze up for a minute or two if you run a huge multi thousand file diff, but I don’t imagine its that. Have you tried disabling magit-revert mode, or eglot mode? LSP or auto-revert checking the file state are usually culprits of lag for me.
Sure it can. Why couldn’t it? At worse, you could write a multi-threaded C library and have emacs/emacsclient call into it.
Why not just run
emacs -nw
on ssh? If latency is bad, use xterm(one of the lowest latency)Or did you install Emacs on the server you SSH’d into?
That one, I believe. Eliminating Tramp from the equation is an easy and effective way to avoid Tramp-based overheads!
Unless your network connection is very slow or otherwise issue-prone, in which case ssh may not be responsive – at which point Tramp offers significant advantages by only occasionally requiring network activity.
I’ve submitted a request to have you banned. Look at your history. You contribute nothing and just spew annoying nonsense. Adios.
The tramp maintainer wasn’t really keen on innovating anymore so somebody needs to volunteer.
I feel like network filesystem + some remote commands/plugins handler would stabilise things more. Even with sshfs mode, remote command doesn’t work.
It really doesn’t make sense that it supports so many network filesystems and none of them support remote command/process. If I could mount network filesystem locally, I wouldn’t use tramp to begin with.
Have you tried just mounting the remote folder with
sshfs
? Then you can just access it as a regular file, not just with emacs, with anything.I’ve been using tramp for remote C++ development for a little over 2 years now and was disappointed with the performance. Especially when it came to things like `git` operations, but general file system operations were noticeably slow.
I’ve not settled on using a OSC 52 supported terminal + tmux + emacs daemon/emacsclient directly on my remote machine. There were only a few keybinds I needed to work around (such as
C-S-/
andC-Backspace
). My tmux prefix key isC-t
which I never used in emacs anyway. The OSC 52 allows me to copy my emacs or tmux selections into my system clipboard so I’m happy about that. I still use GUI emacs locally for things like org and note taking.Overall very happy with this setup!
I mount my development directory over sshfs, and have my own custom hacked up file-handler installed. It dispatches to OS filesystem calls for editing files, but ssh (through ssh+control master) for executing commands.
Eglot seems to work kind of ok. The remote LSP servers seem to die a lot and eglot tends to have difficulty restarting them, but I’m not convinced that’s related to the LSP servers being remote.
I had to disable the emacs VC integration for performance reasons, and I ended up just using git via the command line.
My setup is all quite hacky and I don’t like it, and I’d love a better solution. :)
My current solution: emacs server on remote machine and x2go server. Then remote to it with x2go client, single application mode. I do the same with intellij. Very happy with it. x2go is the best, you have your remote app seamlessly integrated with your host pc. If the connection is lost, just start over again your x2go client, your app still runs in remote host.
Previously I did ssh x forwarding, but I had to compile emacs with lucid toolkit because there is a bug with gtk toolkit which may crash emacs on connection lost.
xpra is an alternative to x2go but it is not as good.
Or if you have time, try lsp-bridge https://github.com/manateelazycat/lsp-bridge, it is truly the fastest lsp client for emacs. It also provides remote development feature similar to vscode. I’d love to hear others’ opinions if they’ve tried it.
If you use Magit, LSP and Projectile to code Rust, have you tried to clone the repo(s) you are working on to your local computer and enable git server on remote so you can push your changes. Or if you don’t wish to enable git server, transfer files from the work machine to remote via some other means (sftp) and just commit when you know you are done. It would remove the latency for the most part. Otherwise you are perhaps better off running Emacs on the remote and forward X to your work station, have you tried? Or probably even faster, just ssh into remote and run Emacs in terminal.
I am not sure if it is tramp problem; it is probably that you are just generating too much traffic if you are using Emacs on a remote as if you would be using it on your workstation.
That’s why I said that model needs to be extended. There’s no reason emacs server couldn’t send stuff over a TCPsocket to emacs client. Emacsclient and emacs server are separate OS processes, so they already communicate via external mechanisms.
When possible, I think it’s much better to edit the code locally and synchronize it periodically with the remote. This doesn’t need to be clunky, and is an extension of the fact that you need to periodically synchronize buffer contents with their file a.k.a. save them.
vscode is king here, even jetbrains feels crap compare to it.
Best solution is emacs on the remote server and get used to the 20ms which doesn’t sound bad IMO, but maybe you have less tolerance than me ;)
There’s no current solution in emacs for what you want and there could never be so I wouldn’t wait for it.