I have been running emacs (x11 version, unwittingly) on wayland without realizing there is a wayland-specific version of emacs. My desktop has started spontaneously going apeshit and crashing. So my first move was to run emacs this way:
$ emacs --fg-daemon
$ emacsclient -c
The idea was that when the display manager goes to shit, I don’t lose my shit. I should be able to simply reattach to my emacs session by running emacsclient -c. Starting the emacs server yields this msg:
Warning: due to a long standing Gtk+ bug¹ https://gitlab.gnome.org/GNOME/gtk/issues/221 Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost. Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Yikes. Note the keyword might crash. So there is an arbitrary chance of survival. So then I discovered there is a wayland-specific version of emacs (emacs-pgtk). Installing it on debian required removing the original X11 version of emacs and resolving some dependency issues by not installing some pkgs. Fine, I did that. Now when I run emacs-pgtk as a server, it starts with:
Due to a limitation in GTK 3, Emacs built with PGTK will simply exit when a display connection is closed. The problem is especially difficult to fix, such that Emacs on Wayland with multiple displays is unlikely ever to be able to survive disconnects.
Fuck. So now when wayland crashes or is shut down, there is no chance of recovery. WTF? I was perhaps better off running the X11 version on wayland, where there is at least a non-deterministic chance of recovery.
¹ Apparently gitlab.gnome.org is an exclusive access-restricted website, so I am blocked from even reading about the bug.


It’s likely rare to use the emacs server mode at all. Most users would consider that extra complexity for nothing as far as their needs go. It has some nuanced advantages for advanced users. Consider that rudel had potential to make server mode broadly interesting for a wide userbase because multiple users could simultaneously collaborate on the same emacs buffer. Rudel is non-debian and not included as part of emacs. And it was last touched 4 years ago IIUC. Then within the already small number of users of the server, some will shutdown the DE and restart it, or switch DEs, or suffer from DE crashes. It’s a quite rare scenario within an uncommonly used feature.
Of course it’s a clear bug that the server does not outlive the DE, and an embarrassment. The reason it has persisted could only be attributed to lack of demand for a fix. You and I are probably like 2 in a million people who care to have it fixed. I can only speculate since I cannot reach the access-restricted bug tracker on gnome.org. I don’t suppose gitlab has a bug voting feature like launchpad does for ubuntu.