Hello,

I just took a quick look at the source code for emacsclient to see if I
could figure out why it failed to find the server file when you placed
.emacs in c:\ which effectively forces Emacs to use c:\ as its home
directory and thus place the .emacs.d directory at c:\.emacs.d and the
server directory at c:\.emacs.d\server.  It did not take me long to find
out.

The algorithm for finding the server directory is very simplistic.  It first
checks for the HOME environment variable.  If it is set, it assumes that the
server directory is at "%HOME%/.emacs.d/server."  On Windows (and no other
operating system) if the HOME environment variable is not set, it checks for
the APPDATA environment variable (which is set by default on Windows XP and all
later versions of Windows to the user's Application Data directory) and
assumes that the server directory is at "%APPDATA%/.emacs.d/server" if it is
set.  That is basically it.

This means that you have three choices if you want to use the Emacs
server/emacsclient functionality.

   1. Place your .emacs file in "C:\Documents and
   Settings\{UserName}\Application Data" (or for people using Windows Vista or
   latter versions of Windows "C:\Users\{UserName}\AppData\Roaming") as I
   have advocated and demonstrated is Emacs preferred location anyway.
   2. If you insist on placing your .emacs file in c:\, set the HOME
   environment variable to c:\ through the System control panel applet.
   3. Continue to use the -f {server_file_name} command line argument when
   starting emacsclient.

I hope this information helps.

Reply via email to