We can also run the emacs server as a daemon on user init in Windows. We take advantage of the user startup folder, where you can put a batch script or shortcut which will be executed on user login.
- Go to the Roaming startup folder by either opening Run Command (Win+R) and typing
shell:startup, or
opening the Windows Explorer (Win+E) and typing shell:startup in the address bar
Create a shortcup by right-clicking, new->shortcut.
Put the location of runeamcs.exe with the
--daemonflag, e.g."C:\msys64\mingw64\bin\runemacs.exe" --daemonRight click the the newly created shortcut, and edit the the init location to some convenient folder,
e.g. your documents folder: %USERPROFILE%\Documents
- (optional) Rename the shorcut to something more meaningful, e.g.
emacs_daemon.exe
To connect to the daemon instead of creating a new Emacs instance, you need to invoke emacsclientnw.exe instead of emacs.exe. To create a shortcut to the client:
Right-click on the Desktop area, new->shortcut
In the location folder, enter
"C:\msys64\mingw64\bin\emacsclientw.exe" -c -na "C:\msys64\mingw64\bin\runemacs.exe"To pin it to the taskbar, double-click on the new shorcut, and in the Emacs taskbar, right-click in the emacs icon-> pin to taskbar