Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using emacsclient #53

Closed
vermiculus opened this issue Mar 15, 2022 · 2 comments
Closed

Using emacsclient #53

vermiculus opened this issue Mar 15, 2022 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@vermiculus
Copy link

Has anyone had luck getting emacsclient to work? I often switch networks, which VcXsrv does not handle well -- usually disconnecting emacs and losing in-progress work.

If I modify wsl-2_4-*.ps1 to instead start emacs --daemon instead of emacs, the daemon launches successfully:

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.
Loading ~/.emacs.d/init-custom.el (source)...
Loading ~/.emacs.d/init-custom.el (source)...done
[Treemacs] Warning: coudn’t find default background colour for icons, falling back on #2d2d31.
[Treemacs] Warning: couldn’t find hl-line-mode’s background color for icons, falling back on #2d2d31.
[yas] Prepared just-in-time loading of snippets (but no snippets found).
Starting Emacs daemon.

With an additional modified version of wsl-2_4-*.ps1 to start emacsclient . instead of emacs:

wsl -d Ubuntu bash -c "export DISPLAY=$wslip`:0.0 export LIBGL_ALWAYS_INDIRECT=1 && setsid emacsclient ~"

I don't see a window (or any debugging information). Using emacsclient -d with the display's IP similarly has no effect.

Using just wsl emacsclient . will launch effectively give me emacs -nw just fine. I just can't get it to use an X display ☹️

@hubisan hubisan added the question Further information is requested label Mar 15, 2022
@hubisan hubisan self-assigned this Mar 15, 2022
@hubisan
Copy link
Owner

hubisan commented Mar 15, 2022

Tried the following:

Started the WSL terminal (using WSL1):

emacs --daemon
exit

Then I launched another terminal and successfully launched emacsclient:

export DISPLAY=:0.0
export LIBGL_ALWAYS_INDIRECT=1
setsid emacsclient --create-frame ~ && exit

Used the --create-frame (alias is just -c) option to Create a new frame instead of trying to use the current Emacs frame to make sure a frame is created.

You can probably change the line in the first script from

wsl -d Ubuntu-20.04 bash -c "export DISPLAY=$wslip`:0.0 export LIBGL_ALWAYS_INDIRECT=1 && setsid emacs"

to

wsl -d Ubuntu-20.04 bash -c "emacs --daemon"

And in the second to:

wsl -d Ubuntu-20.04 bash -c "export DISPLAY=$wslip`:0.0 export LIBGL_ALWAYS_INDIRECT=1 && setsid emacsclient -c ~"

@hubisan
Copy link
Owner

hubisan commented Apr 8, 2022

Closing this as there was no follow up for almost a month.

@hubisan hubisan closed this as completed Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants