0

On a Windows machine I run the MobaXterm X server system. I use this to display Emacs running on a remote Linux machine. This works fine.

I also use this X system to display Emacs running on a WSL Linux on the same Windows machine. This does not work great: Each time the Windows machine goes into hibernation the WSL Emacs crashes and I get the following message:

Connection lost to X server '10.1.2.3:0.0'
When compiled with GTK, Emacs cannot recover from X disconnects.

The remote Linux Emacs continues running as if nothing has happened. Both Emacses are compiled with GTK+.

Firstly I do not understand why the crash only happens for the WSL Emacs. After all it is the same X server as for the remote Emacs, so the disconnect should happen for both Emacses, shouldn't it?

Secondly, how can I solve this issue with WSL? Do other X servers for Windows work better? Is there a X-capable Emacs not using GTK which recovers better from temporary disconnects on hibernation.

Note: Due to the fact that on the Windows machine I work mainly in the WSL environment (and have set up all the CLI tools tools like grep and hunspell, it is much easier to have Emacs running there too for corresponding Emacs commands like find-grep-dired or ispell.

1 Answer 1

0

Just use the native Windows build of Emacs. Emacs is a cross–platform program, so you don’t need to use WSL to run it. All that does is slow things down and introduce extra complexity.

Edit:

How can I solve this issue with WSL?

I just want to clarify that this isn’t a problem with WSL specifically. Any GTK application, not just Emacs, will exit when it notices that it has lost its connection to the X server. The GTK library itself does this; there’s nothing the application can do to override it. If you don’t want this to happen, don’t use a GTK build of Emacs. Use an Athena build, or the native Windows build.

2
  • Due to the fact that on the Windows machine I work mainly in the WSL environment (and have set up all the CLI tools tools like grep and hunspell, it is much easier to have Emacs running there too for corresponding Emacs commands like find-grep-dired or ispell. - Updated the question accordingly. Commented May 13 at 8:06
  • Surely you can just set Emacs’s exec-path so that the WSL binaries are found first. Commented May 13 at 9:32

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.