1

How can I get package-el to list packages again?

This morning I did a routine M-x package-list-packages on my Emacs 24.3.1 W32 installation. In a fit of ill-judged bravado I used U to upgrade all 15 packages that could be upgraded. When the dust had settled and I rebooted Emacs, I saw a number of errors that seem to be related to absolute paths being used to refer to various packages in my init files. This post covers a similar problem but does not seem to have been resolved. I note that other people are having similar issues so my situation is not unique.

I've managed to mostly fix the problems I encountered, but package-list-packages no longer works as it cannot find and load the archives file/s, generating the following messages:

Contacting host: tromey.com:80
Saving file g:/Dropbox/code/.emacs.d/.emacs.d/elpa/archive-contents...
Wrote g:/Dropbox/code/.emacs.d/.emacs.d/elpa/archive-contents
Contacting host: tromey.com:80
Saving file g:/Dropbox/code/.emacs.d/.emacs.d/elpa/builtin-packages...
Wrote g:/Dropbox/code/.emacs.d/.emacs.d/elpa/builtin-packages
if: Cannot open load file: g:/Dropbox/code/.emacs.d/.emacs.d/elpa/archives/-pkg

The directory G:/Dropbox/Code/.emacs.d/.emacs.d/elpa/archives contains 3 folders, gnu, marmalade and melpa and each contains a file named archive-contents which is what I would expect.

The situation is similar to the one outlined in this question but the proposed solution doesn't seem appropriate here as I am already using the version of package.el that is suggested in that post (0.9). Trying a newer version (1.0.1) gives me a different error related to package--description-file. (This is also the error reported in this cry for help but I haven't been using snapshot version of Emacs.)

My .init file has these two lines at the top (perhaps the second is redundant?):

(add-to-list 'load-path "g:/dropbox/code/.emacs.d/")
(add-to-list 'load-path "g:/dropbox/code/.emacs.d/.emacs.d/elpa/")

and this call at the bottom:

(load-file "G:/dropbox/code/.emacs.d/initfiles/init-package.el")

which in turn contains this:

(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

Any suggestions as to what I have broken and how to fix it?

Community
  • 1
  • 1
SlowLearner
  • 7,907
  • 11
  • 49
  • 80
  • 1
    It looks like Emacs is confused regarding the location of the `user-emacs-directory`, which is normally set to `~/.emacs.d/`. My first thought would be to set this manually to see if that restores functionality. If the upgraded installations actually went into `g:/dropbox/code/.emacs.d/.emacs.d`, then you will probably need to manually delete those erroneous installations and try again upgrading those packages -- keeping the manual setting of the `user-emacs-directory`. Perhaps try using: `(setq user-emacs-directory "g:/dropbox/code/.emacs.d/")` – lawlist Nov 24 '13 at 14:35
  • I assume you want the `elpa` directory to be one directory up instead, so comment this out: `(add-to-list 'load-path "g:/dropbox/code/.emacs.d/.emacs.d/elpa/")` – lawlist Nov 24 '13 at 14:41
  • Thanks for this. I'm not sure what the problem was, but I moved the contents of `g:/dropbox/code/.emacs.d/.emacs.d` to `g:/dropbox/code/.emacs.d` and did a search and replace of the entire directory with PowerGREP to ensure that all my references pointed to that. Secondly - and this may have been equally important - I deleted all the `.elc` files in my init directory and then recompiled using `byte-recompile-directory`. It now seems to be working again. I will watch it for a day or two to check. – SlowLearner Nov 24 '13 at 15:14
  • One way to test whether the `elpa` directory is appropriately recognized by `package.el` would be to temporarily rename your `g:/dropbox/code/.emacs.d/elpa` to something like `g:/dropbox/code/.emacs.d/elpa-original`. Then restart Emacs and try installing a package and see if it creates a new `elpa` directory like this: `g:/dropbox/code/.emacs.d/elpa`. If it does, then your `user-emacs-directory` is set correctly. If not, then you may need `(setq user-emacs-directory "g:/dropbox/code/.emacs.d/")`. When the test is done, delete the new `elpa` directory and restore your original `elpa`. – lawlist Nov 24 '13 at 15:47

0 Answers0