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.

  • Xuqi@todon.nl
    link
    fedilink
    arrow-up
    2
    ·
    13 hours ago

    @evenwicht To add a data point: When using KDE (and Proton) on Wayland, my emacs crashes 90% of the time if the computer wakes from suspend, and 100% crashes when the desktop switches from light mode to dark mode and vice versa. After switching to another wayland compositor and DE Emacs never crashes.

    • evenwichtOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      13 hours ago

      what is DE? I am using sway on wayland. Maybe I should replace sway with something else.

      (edit) although I should say emacs never crashes for me /without provocation/. But when wayland crashes, then the emacs daemon often crashes as a consequence.

      • Xuqi@todon.nl
        link
        fedilink
        arrow-up
        2
        ·
        13 hours ago

        @evenwicht My bad, I should make clear that DE = desktop environment. And I did not use the word properly since I did not replace the whole KDE thing. I use niri + noctalia now.

  • Zenie@piaille.fr
    link
    fedilink
    arrow-up
    2
    ·
    14 hours ago

    @evenwicht

    Yea, that is an old one. I did just read something here about it. It seems like there was some enlightenment.

    But the devs on both sides are in denial about it.