My initial quest is Can emacs on Mac using native window system connect to an emacs server on a Linux system but I got off on a tangent that might work ok but I hit a speed bump.
As described in the other question, I start emacs in daemon mode via the systemd script on Ubuntu.
I download and start XQuest and reboot my system. Now, every shell has
DISPLAY set to a local socket.
ssh -Y xxx works as expected causing the display to be on my Mac but inside XQuatz (X11). Fine... this is looking promising (although not my original goal).
Then the speed bump -- which I've hit long long ago.
If I do (from my Mac)
ssh -Y xxyyzz /usr/bin/emacsclient -f server -c, I get an X11 window on my Mac connected to the server on xxyyzz. If I
^C the ssh, the window dies -- fine. But the emacs daemon also dies taking along with it any shells running within it.
This quest is to prevent the emacs daemon from dying when the display socket abruptly closes. I've tried setting
debug-on-signal but the daemon still exits. No message ... nothing.
I also connect to the same emacs daemon from a terminal local to the Ubuntu server. I thought I could see a message or something but no luck. When I
^C the ssh job, the terminal goes back to the command prompt with the terminal still in raw mode so I have to do
^Jreset^J to get the terminal back to a sane state again.
So... I thought I would try to debug this with gdb. Stopped the systemd service. Did
gdb /usr/bin/emacs and then
run --daemon but then I hit another problem because emacs detaches and gdb doesn't catch the error. As a sub-quest of this 2nd quest -- how can I get emacs in daemon mode not to detach? Or... perhaps I can tell gdb (I don't use gdb much -- sorry) to also debug the detached forks?
This may be a duplicate of emacs --daemon crashes when parent ssh session dies