2
votes

I need to add various packages to my emacs installation. It comes with tromey as the only repository. The variable package-archives is not defined (!). I am running GNU Emacs version 24.3.1 on Linux. I set up the following code in my .emacs file:

    (when (>= emacs-major-version 24)
      (require 'package)
      (setq package-enable-at-startup nil)
      (setq package-archives '())
      (package-initialize)
      (add-to-list 'package-archives
                   '("melpa" . "http://melpa.milkbox.net/packages/") t)
      (add-to-list 'package-archives
                   '("gnu" . "http://elpa.gnu.org/packages/"))  
      (add-to-list 'package-archives
                   '("marmalade" . "https://marmalade-repo.org/packages/"))
      (add-to-list 'package-archives
                   '("org" . "http://orgmode.org/elpa/") t)
      (add-to-list 'package-archives
                   '("tromey" . "http://tromey.com/elpa/") t)
      )

By default, without this code, the variable package-archives isn't defined. After running this code, it is, and contains the right values, but doesn't seem to have any effect. I verified that this variable is not customized anywhere.

The problem is that I don't get to see any packages from the various archives I added; Only from tromey. Obviously I'm doing something wrong, but this code is supposed to work from emacs version 24 and higher.

Can someone suggest how to set up my repositories properly?

1
Have you run package-refresh-contents? "Download descriptions of all configured ELPA packages. For each archive configured in the variable `package-archives', inform Emacs about the latest versions of all packages it offers, and make them available for download." Alternatively, use the graphical menu M-x package-list-packages, which automatically refreshes the local package list.Chris
Yes I have. But only tromey.com seems to be consulted. The variable package-archives contains everything I want, and it's as if it's just not consulted.Mayer Goldberg
Is it literally showing up as tromey? I think it should say gnu or just elpa now… Did you try to install package.el manually, or are you using the built-in version? Have you tried with emacs -Q, which suppresses your config from being used?Chris
It shows that it's connecting to tromey.com:80, and then displays a list of packages. It never shows any other hosts. I get your point about displaying the url rather than the key in the package-archives alist, but I don't know how and why it's not consulted. I'm using the builtin package.el.Mayer Goldberg
Please run Emacs as emacs -Q, then paste the snippet above into *scratch* and evaluate it with M-x eval-buffer RET. Then see if you get different results.Chris

1 Answers

0
votes

Everything worked well! What does that mean? That something in my .emacs file is conflicting with elpa?

That's exactly what it means.

Comment out half of your configuration (comment-dwim, bound to C-; by default, might be helpful here) and see if that fixes it. That will tell you which have contains the ELPA conflict. Repeat with the half that shows the problem to find which quarter is problematic, then again to find the eighth…

Pretty soon you'll find the cause, which might be a single sexp. Remove or adjust that, uncomment the rest of your config, and enjoy the plethora of packages that await.