Currently I have two versions of Emacs (system installed by apt-get: emacs26 and my own compiled version emacs27). They both us emacs.d directory, and I wonder what happens the packages are incompatible with emacs27. May I use a different .emacs.d" such as.emacs27.d` for only emacs27.

Is it okey to use the same directory for different version of Emacs.

  • In order to separate the installation configurations, one option would be to configure user-emacs-directory and also the package-user-dir. When starting Emacs, it is possible to check the Emacs version and programmatically make decisions on which configurations to load. Depending upon the packages (built-in and add-on), there are other variables that may need to be adjusted to control the location that files will be stored. I keep everything in one main directory (with sub-directories) so that I can back-up and synchronize between machines, along with accessing from a virtual machine. – lawlist Jun 12 at 20:11
  • @lawlist If you would expand your comment a bit on where to set user-emacs-directory and package-user-dir it would make a great answer. I think for Emacs27 one should set package-user-dir in the early-init.el file. – Tobias Jun 12 at 22:25
  • @Tobias -- thank you for mentioning the new early-init.el file. When I changed the user-emacs-directory, my recollection is that I had to deal with a number of variables that had to be adjusted to make all of my favorite packages store files in my preferred locations. I am not confident that all of the variables rely upon the user-emacs-directory as the base; however, it sure would be nice if that were the case. I see an answer to this particular thread as a potential Pandora's Box where the O.P. may have several follow-up questions/problems, and future Google-ers may also need help. – lawlist Jun 13 at 4:55
  • More Reasonable Emacs has builtin supports for multiple versions Emacs, github.com/junjiemars/.emacs.d – 南山竹 Jun 13 at 12:57

I was in a similar situation few weeks ago, I wanted to have a fresh emacs instance but still wanted the old emacs around if I needed.

I made a folder called


and when starting emacs I told emacs the home dir is that,

HOME=/Users/administrator/newhome emacs example.txt

Remember to create a .emacs.d in the newhmoe directory too.


If you update packages in Emacs 26 you can use the same .emacs.d directory from Emacs 27.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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