XDG Compliant user (early) packages tree.
authorSteve Youngs <steve@sxemacs.org>
Thu, 4 Jun 2015 13:36:25 +0000 (23:36 +1000)
committerSteve Youngs <steve@sxemacs.org>
Thu, 4 Jun 2015 13:36:25 +0000 (23:36 +1000)
commit30e80ecbf0baf6d0bed7780ee90cfa1859546f4f
tree139b83f892635b2d0b135a42488fe3ac2ee80c64
parent4bf599c548264a82eae767411cb613033dd2273b
XDG Compliant user (early) packages tree.

With this changeset, the location for a user's local packages, the ones
that make up `early-packages', is now under ${XDG_DATA_HOME}/sxemacs.
That is normally ~/.local/share/sxemacs, which is the directory used when
the XDG environment variable isn't set.

If the user has forced use of the old legacy ~/.sxemacs for their init
directory, then that is where the early-packages will be instead of the
XDG location.  A warning is displayed if package subdirectories are
detected in any 2 or more of ~/.sxemacs, ${XDG_CONFIG_HOME}/sxemacs, and
${XDG_DATA_HOME}/sxemacs (symlinked directories are ignored).

There is also a new command line switch, `-user-pkgs-directory' to set the
early-packages directory to any location.

* lisp/package-admin.el (package-admin-find-top-directory): Use
`user-packages-topdir' instead of `user-init-directory'.
(package-admin-get-install-dir): Ditto.

* lisp/package-get.el (package-get-package-index-file-location):
Default location is now in `user-packages-topdir' instead of
`user-init-directory'.
(package-get-install-to-user-directory): Renamed from
`package-get-install-to-user-init-directory'.  The latter is
defvaralias'd back.
(package-get-maybe-save-index): Use `user-packages-topdir' instead
of `user-init-directory'.

* lisp/packages.el (packages-find-user-topdir): New.  Returns
`user-packages-topdir'.
(packages-compute-package-locations): Rename the arg to
`user-packages-topdir', and update the doc string.

* lisp/startup.el (command-line-do-help): Add `-user-pkgs-directory'.
(command-line-early): For `-user' set an XDG compliant directory
for `user-packages-topdir' if possible, fall back to the legacy
.sxemacs otherwise.
(startup-setup-paths): Use #'packages-find-user-topdir to set
`user-packages-topdir'.

* src/emacs.c (vars_of_emacs): New var, `Vuser_packages_topdir'.
(main_1): Handle new command line arg, `-user-pkgs-directory'. Set
`Vuser_packages_topdir'.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
lisp/package-admin.el
lisp/package-get.el
lisp/packages.el
lisp/startup.el
src/emacs.c