title: How can one specify a user's emacs init file to load with emacsclient?
body: <p><strong>Question</strong></p>
  
  <p>How can one specify a user's emacs init file to load with emacsclient?</p>
  
  <p>emacsclient does not understand '-u user' and '-a ALTERNATE-EDITOR' does not allow me to quote it and provide '-u user'.</p>
  
  <p>For example, running:</p>
  
  <pre><code>/usr/bin/emacsclient -n -a '/usr/bin/emacs -u &lt;username&gt;' ~&lt;username&gt;/notes.txt
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>/usr/bin/emacsclient: error executing alternate editor "/usr/bin/emacs -u &lt;username&gt;"
  </code></pre>
  
  <p><strong>Background</strong></p>
  
  <p>I'm using emacs version 23.1.1 and emacsclient version 23.1.</p>
  
  <p>emacs itself supports '-u user' to load a specified user's init file.</p>
  
  <p>I use the following bash function in my aliases file to invoke emacs</p>
  
  <pre><code># a wrapper is needed to sandwich multiple command line arguments in bash
  # 2&gt;/dev/null hides
  #   "emacsclient: can't find socket; have you started the server?"
  emacs_wrapper () {
    if [ 0 -eq $# ]
    then
      /usr/bin/emacsclient -n -a /usr/bin/emacs ~&lt;username&gt;/notes.txt 2&gt;/dev/null &amp;
    else
      /usr/bin/emacsclient -n -a /usr/bin/emacs $* 2&gt;/dev/null &amp;
    fi
  }
  alias x='emacs_wrapper'
  </code></pre>
  
  <p>Typing x followed by a list of files:</p>
  
  <ul>
  <li>Connects to an existing emacs server if one is running, otherwise starts a new one</li>
  <li>Executes as a background process</li>
  <li>Opens the list of files or my notes file if no files are provided</li>
  </ul>
  
  <p>This works great when I'm logged in as myself.  However, many production boxes require me to log in as a production user.  I've separated my aliases into a bash script, therefore I can get my aliases and bash functions by simply running.</p>
  
  <pre><code>. ~&lt;username&gt;/alias.sh
  </code></pre>
  
  <p>Unfortunately, this won't let me use my .emacs file (~&lt;username&gt;/.emacs) :(</p>
  
  <p>This problem has been driving me crazy.</p>