For testing other issues I have, I start emacs with -Q, to avoid the probable errors in my init file.

In that emacs session, running M-x package-list-packages still shows me all the packages that I install in my ~/.emacs.d/init.el.

This surprises me, I thought that I would have that emacs session clean.

What is happening? Is package-list-packages just showing what it finds in a cache, rather than what is actually available in that session? How to I verify which packages are actually used in that session?

To be clear, in response to the comment from @g-gundam:

emacs -Q followed by M-x package-list-packages lists packages as "installed". These packages are the ones my the init file, the ones that would have been used without -Q.

Maybe relevant, my init file (should not be used since -Q) starts with this:

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))

(unless package-archive-contents
(unless (package-installed-p 'use-package)
  (package-install 'use-package))
(require 'use-package)
  • 2
    Just to be clear, does anything in the Status column say installed? When I run emacs -Q and do M-x package-list-packages, I only have status values of available, built-in, and incompat. See gist.github.com/g-gundam/ecedd188f5b17144b41b11727072e55e
    – g-gundam
    Commented Oct 28, 2022 at 13:36
  • 1
    @g-gundam Correct, I have a lot of "Installed" there. I updated my question and tried to clarify, thanks.
    – Gauthier
    Commented Oct 31, 2022 at 12:11
  • 1
    If you want a completely clean emacs startup, then you need to do HOME=/tmp emacs
    – rpluim
    Commented Nov 2, 2022 at 11:31

1 Answer 1



Looking again into it, I see that I made a mistake here. The 'intial comment' in package.el mentions that on activation, the load-path, info-path and autoloads of a package get set up, but it does not mention that the package gets loaded. So on activation, a package gets known/available to Emacs itself (while package-initialize makes it only known to the package manager). Finally, the package gets loaded via the autoload mechanism, only when some autoloaded function gets called.

Finally, a package can consist of multiple files/features, and not all features have to get loaded at once. We can see which features got activated via the features variable, and we can find which features/files actually got loaded via the load-history.


'package-list-packages' calls 'package-initialize'. As far as I remember (from looking into it recently), 'package-initialze' fills the package-alist with packages available at the archives (when using -Q only 'gnu' and 'non-gnu' ELPA), and it also adds packages from scanning your directory with installed packages. Anyway, it only 'initializes' the packages, meaning that they get 'known' to the package manager.

The packages do not get 'activated' (which happens when a package gets loaded). To see the list of activated/loaded packages, see package-activated-list (source: this SE answer).

  • 1
    C-h v package-activated-list shows an empty list, indeed. Thanks!
    – Gauthier
    Commented Nov 1, 2022 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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