1

My company's I.T. department has assigned our HOME directory to a network server.
With the COVID-19 pandemic we are now using VPN to connect to the company's network.
Having to to go through VPN to access the HOME directory is slowing the initializing of Emacs.
(I have to access the HOME drive through Windows Explorer at least once or Emacs won't find it.)

I would like to have Emacs access the .emacs file in my local user folder without changing the HOME environment variable. (I can't change the HOME directory because other applications use it.)

How do I tell Emacs to use a different folder for initialization, without command line? (I invoke Emacs by double clicking files in the Windows 10 Explorer.)

Note: The research of changing the .emacs location all use the HOME environment variable.
I'm using Emacs 27.1 on Windows 10

5
  • 1
    You may wish to consider customizing variables such as user-emacs-directory and package-user-dir. There will be other variables along the way that will need to be adjusted as well, but those two should get you started. My .emacs on the Windows machine is a one-liner that loads my entire setup that is stored elsewhere.
    – lawlist
    Commented Jan 29, 2021 at 21:17
  • Would these variables need to be customized in the .emacs file? Commented Jan 30, 2021 at 1:02
  • Without getting into changing settings, how about a one-liner for the .emacs of your company HOME folder which loads your own custom .emacs wherever it may be (e.g., locally). I.e., add the following one-liner to your company HOME folder .emacs file: (load "/path/to/your/local/.emacs" nil t t nil) Then, once you get that setup working, you may wish to add settings for the above-described variables to your local .emacs file ... I can't realistically give a tutorial for setting those variables in just a few words within a comment here ...
    – lawlist
    Commented Jan 30, 2021 at 1:42
  • ... or do emacs -q -l /path/to/your/local/.emacs perhaps in a shell script (or whatever Windows calls them: batch files?)
    – NickD
    Commented Jan 30, 2021 at 12:35
  • I changed my PATH directory to my local user folder. The start up speed was a lot faster. However, applications like "git" were not functioning (since it wanted the network folder as its home folder). The "load" function in the .emacs did not have any effect. Commented Feb 3, 2021 at 20:59

1 Answer 1

-1

I use Emacs's "HOME" directory designator ~/ (as in ~/.emacs) in Emacs 24.3.1 on MS Windows 7 to locate my .emacs file. ~/ is translated by Emacs into c:/Users/MYUSERNAME/AppData/Roaming/ on my machine, regardless of my current connected directory. To see whether something like this could work for you, there are two steps you can take:

  1. In Emacs, run the directory editor dired on the directory ~/ (by typing C-x d ~/ RET) to find out where Emacs thinks your home directory is located. Dired will list the files in this "home" directory, and will show the directory's full pathname on the first line.
  2. Locate and read Sec. G.5 of your built-in Emacs documentation, entitled HOME and Startup Directories on MS Windows. This is the fifth section of Appendix G: Emacs and Microsoft Windows/MS-DOS of the documentation. Sec. G.5 is also available online at https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-HOME.html#Windows-HOME .

These steps will help you to determine whether your company's assignment of the HOME directory to a location not on your local computer has left open any possibility of locating your .emacs file on your local computer, in a place where Emacs will know to find and use it.

One final suggestion: There is a cleaner, design-supported way to invoke Emacs, namely, include Emacs on your Windows 10 Start Menu rather than just clicking on an executable file. A Google search for "windows 10" "start menu" will bring up a lot of useful material relevant to this task.

2
  • 1
    Where do you use it? and when? Commented Jan 29, 2021 at 21:59
  • I use it in Emacs by typing C-x C-f ~/.emacs RET (the find-file command) whenever I want to edit my .emacs file.
    – Emacs-Lew
    Commented Jan 30, 2021 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.