For some reason (see below) I wanted to set package-user-dir
(ELPA) to the site-lisp-directory.
It should be possible to deduce the site-lisp-directory from the standard exec-directory
variable:
(setq site-lisp-directory (concat exec-directory "../site-lisp")
At least with the precompiled Emacs-versions from GNU this works (the directory already exists). Eventually create the directory:
(unless (file-accessible-directory-p site-lisp-directory)
(make-directory site-lisp-directory))
My motivation was that package-user-dir
by default is %USERPROFILE%/.emacs.d/elpa/
, which seems to be a rather strange location. Packages shall be installed system-wide for all users. Also ~/.emacs.d
contains server settings, auto-save-lists and backups. What have packages to do there when Emacs has a dedicated site-lisp-directory one can ask.
However, the real "problem" was the precompiled Emacs 24.3 for Windows. It requires no installation and hence can be run portably, like from a stick. IMHO ELPA should then use its site-lisp-directory, so that the packages are installed portably too.