2

Due to the COVID19, I am working from home via VPN. The HOME directory is set to a directory on the company network. Other applications use this directory as well.

I would like to have Emacs use a local HOME directory without changing the HOME environment variable (used by other applications). I'm hoping this will speed up Emacs.

The manual and other issues say to change the value of the HOME environment variable in order load the .emacs and other initialization files. I can't do this because other applications refer to the HOME directory.

I have Windows 7 set up to run "runemacs.exe" when a ".cpp" file is double clicked in File Explorer.

So, how do I change the Emacs home directory, so that File Explorer can pass the HOME directory to Emacs (?via command line?)?

7
  • I do understand that you're using a remote emacs in your local computer. If that's true you won't gain anything using a local home for it as it will a two-way trip for emacs config. I'd look to use a local emacs which will edit the remote files if you can't work locally and push to the company repository. Anyway, the manual has a section on how to set up the windows HOME.
    – Muihlinn
    Apr 15, 2020 at 17:48
  • I'm running Emacs on my local computer. The network is only used for the Home directory for Emacs. Again, changing the windows HOME affects all applications that use the home directory (for example Git Extensions and Git). So I want to know how to supply a Home directory to Emacs either command line or when a file is double clicked in File Explorer. I don't want to have to copy the network home directory to my local PC directory because I changed the HOME environment variable. Apr 15, 2020 at 18:00
  • There are a couple of options in the FAQ
    – Muihlinn
    Apr 15, 2020 at 18:15
  • The difficulty is "if the HOME environment variable exists, use the value of it". I want to specify a different home directory than the one I have set. Apr 15, 2020 at 18:18
  • Then use a site-profile in your emacs. It loads before your init file and you can do whatever you need there.
    – Muihlinn
    Apr 15, 2020 at 18:35

1 Answer 1

2

I had the same problem, my solution was Copy the file site-start.el to the folder

<drive>:\Emacs\Share\emacs\Site-lisp 

This folder is located where Emacs is installed

I’ve created a new permanent environment variable which hold my home folder for Emacs.

SETX CHDKA_HOME_CONFIG_EMACS “d:\Personal data\.config\emacs”

Assign the value to the HOME variable in Emacs.

site-start.el contains:

;; Use my CHDKA_* Base structure
(setenv "HOME" (convert-standard-filename (getenv "CHDKA_HOME_CONFIG_EMACS")))

Now Emacs knows where to find my init.el.

1
  • I want to confirm that this works and changes "HOME" only for EMACAS. So EMACS can run at the same time as another application that uses a different "HOME", Jun 2 at 15:26

Your Answer

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

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