Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.rcp: don't override package-user-dir #1641

Merged
merged 1 commit into from
Apr 17, 2014

Conversation

npostavs
Copy link
Collaborator

Put what we used to override package-user-dir with as the first element
of package-directory-list instead; that way, if a user has packages
installed there, package.el can still find them.

fixes #799


I'm fairly sure this works, but as this change is a bit delicate, it would be good to have some more "real world" testing before merging it.

@npostavs
Copy link
Collaborator Author

I used the following code for testing, run the 2nd time with DO_NOT_CLEAN=t ./run-test-interactive.sh, and poked around in ~, package-list-packages and el-get-list-packages seemed correct.

(setq el-get-sources
      ;; smallest GNU ELPA packages I could find
      '((:name load-dir :type elpa)
        (:name num3-mode :type elpa)
        (:name memory-usage :type elpa)))

;;; install to the old package dir: ~/.emacs.d/el-get/package/elpa
;;; XXX: comment this out for second run
(el-get 'sync "load-dir" "num3-mode")

;;; now update `package-user-dir' to the standard
(push '(:name package
              :post-init
              (progn
                ;; restore package.el's original values
                (setq package-user-dir
                      (locate-user-emacs-file "elpa")

                      ;; Defaults are subdirs named "elpa" in the site-lisp dirs.
                      package-directory-list
                      (let (result)
                        (dolist (f load-path)
                          (and (stringp f)
                               (equal (file-name-nondirectory f) "site-lisp")
                               (push (expand-file-name "elpa" f) result)))
                        (nreverse result))

                      package-archives
                      '(("gnu" . "http://elpa.gnu.org/packages/")))

                ;; add package.rcp's old `package-user-dir' to
                ;; `package-directory-list', in case there are
                ;; packages installed there from before
                (let ((old-package-user-dir
                       (expand-file-name
                        (convert-standard-filename
                         (concat (file-name-as-directory
                                  default-directory)
                                 "elpa")))))
                  (when (file-directory-p old-package-user-dir)
                    (push old-package-user-dir package-directory-list)))))
      el-get-sources)

(el-get 'sync)

Put what we used to override package-user-dir with as the first element
of package-directory-list instead; that way, if a user has packages
installed there, package.el can still find them.
@npostavs npostavs merged commit 84981a1 into dimitri:master Apr 17, 2014
@npostavs npostavs deleted the pkg-dir branch April 23, 2014 23:08
@npostavs npostavs mentioned this pull request May 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package package sets package-user-dir
1 participant