tchakravarty
tchakravarty

Reputation: 10984

Independent emacs installations and locations of the .emacs.d directory and the .emacs file

I have multiple installations of emacs on my Windows 7 computer, each configured slightly differently. Let's say installation1 and installation2, where installation1 is the main emacs, and installation2 is subsidiary.

I would like to maintain two sets of .emacs files and .emacs.d. directories, such that installation1 looks for it in the default HOME or %appdata% directory (C-x C-f ~/.emacs RET), but that installation2 cannot find the .emacs file in these directories at all. That is, I would like installation2 to not look in the HOME or %appdata% locations for the .emacs.d directory or .emacs file. Ideally, this would be implemented by redefining the ~ expansion for installation2.

I guess I could have a (add-to-list 'load-path "C:/installation2-location/.emacs.d/lisp/") and save it to a .emacs file in the same directory as the installation2 emacs executable, but I am not sure that this is a robust solution.

Suggestions welcome.

Upvotes: 0

Views: 335

Answers (1)

PuercoPop
PuercoPop

Reputation: 6807

Well you can use the system-type variable. From the Emacs help

system-type is a variable defined in `C source code'. Its value is darwin

Documentation: The value is a symbol indicating the type of operating system you are using. Special values: gnu' compiled for a GNU Hurd system.gnu/linux' compiled for a GNU/Linux system.
gnu/kfreebsd' compiled for a GNU system with a FreeBSD kernel. darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...).
ms-dos' compiled as an MS-DOS application.windows-nt'
compiled as a native W32 application. `cygwin' compiled using the Cygwin library. Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix, hpux, irix, usg-unix-v) indicates some sort of Unix system.

Or use system-name to determine discriminate between machines of the same of.

Finally you can make a function to load what you want in installation-1 and another to load what you want in installation-2. But I can't see any valid reason as to why you would want to maintain different emacs.d in the same machine.

Upvotes: 1

Related Questions