Automatically starting a server if one is not already started
This should be the same for any Emacs build. Add this snippet to your
.emacs or .emacs.d/init.el.
(require 'server)
(unless (server-running-p)
(server-start))
And then just start emacs by running the runemacs.exe executable that comes with the build.
How to call emacs so that it utilizes the server (e.g. from command line or third party tools)
Emacs' Windows build comes with an emacsclientw.exe executable in the
bin/ directory. Use the full path to that executable as your editor
of choice on any third party tools you need to configure.
Context menu support (e.g. right-click on a file and allow it to be sent to emacs for viewing and editing)
- Right click on a file, select
Open With -> Select Default Program.
- In the window that pops up, navigate to your
emacsclientw.exe executable mentioned above and choose it.
- If you don't want Emacs to be the default, do steps 1 and 2 again, choosing a different program as the default.
emacsclientw.exe will now always be an option in the context menu.
EMACS_SERVER_FILEthat pointed to my.emacs.d\serverdirectory. – Ryan Sep 30 '14 at 00:10(server-running-p)returns:otheron Windows (even after trying setting thatEMACS_SERVER_FILEenv var. – Kaushal Modi Nov 05 '15 at 04:06(setq server-use-tcp t) (defun server-ensure-safe-dir (dir) "Noop" t)and settingEMACS_SERVER_FILEto point NOT to the directory but to the actualserverfile (For me that wasPATH\TO\.emacs.d\server\server). – Kaushal Modi Nov 05 '15 at 04:27