3

When I try run describe-variable on package-archive-contents C-h v package-archive-contents emacs hangs. It hangs at least 5 minutes, maybe forever (I did not wait any longer).

Seems like Esc : (print package-archive-contents) also almost hangs.. It outputs an enormous string to message buffer after a minute. When trying to copy the string to the clipboard emacs hangs again..

I am running Emacs version 25.1 on Ubuntu 16.10.

Running C-h v package-archives gives current value:

 (("gnu" . "http://elpa.gnu.org/packages/") ("marmalade"
 . "http://marmalade-repo.org/packages/") ("melpa"
 . "http://melpa.milkbox.net/packages/") ("org"
 . "http://orgmode.org/elpa/"))
  • package-archive-contents contains meta-information about all versions of all packages in all archives. That's a huge amount of data; printing all of it naturally takes quite some time. – lunaryorn Oct 25 '16 at 10:44
  • 1
    @lunaryorn Agree. But I was only trying to get the documentation for the variable: C-h v package-archive-contents. It should not try to print the variable (if it is large) when a user tries to get the documentation – Håkon Hægland Oct 25 '16 at 11:02
  • I see. I guess you need to report that as a bug – lunaryorn Oct 25 '16 at 21:35
3

To debug Emacs, it's always best to start a new instance with the -q option. This opens Emacs without loading an init file. You can then start investigating with the C-h v and C-h f commands which open documentation for variables and functions, respectively.

It looks like package-archive-contents is not part of base Emacs, but rather package.el. Execute (require 'package) to load it. Once package.el has been loaded, the documentation for variable package-archive-contents reads as:

package-archive-contents is a variable defined in ‘package.el’.
Its value is nil.

  This variable may be risky if used as a file-local variable.

Documentation:
Cache of the contents of the Emacs Lisp Package Archive.
This is an alist mapping package names (symbols) to
non-empty lists of ‘package-desc’ structures.

The cache of the Emacs Lisp Package Archive may be quite large. In the case of Emacs being opened with -q, only elpa will be cached. To do this, run (package-initialize). Now the documentation for package-archive-contents will take longer to load. It took several minutes for me. This is because the value is no longer nil. The value is 1000+ lines of information. Consider that in your case, you have the additional archives of melpa and marmalade.

  • It should be faster in Emacs 26, for earlier versions, indenting lisp was quadratic in the number of lines of the expression being indented (see Bug#25122). – npostavs Jan 29 '18 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.