Open Emacs GUI in WSL2 through X server conveniently
Add shortcut and context menu item for Emacs in Windows.
The scripts will start X server automatically.
-
Open powershell as administrator
-
Set powershell executionPolicy
Set-ExecutionPolicy Unrestricted -
Copy
emacs_start.shto wsl user's home. -
Edit
powershellScriptPathinemacs_start.vbs.powershellScriptPath="D:\emacs\wsl-emacs-contextmenu\emacs_start.ps1"
-
Edit some variables in
emacs_start.ps1.$wslUserName = "smj" $xServerPath = "D:/mobaxterm/MobaXterm.exe" $xServerProcessName = "mobaxterm" $xServerOptions = " -hideterm" $wsl = "ubuntu.exe"
-
Edit paths in
EditWithEmacs.reg. -
Import registry
EditWithEmacs.reg. -
Copy
Emacs GUI.lnkto your desktop and modify its property, or create a new shortcut on yourself. -
if some error occurs, set
visibleinemacs_start.vbsto1and see what happened. -
emacs_start.shset some environment variables for the X server, modify it if you need.
