2

I'm running Emacs from HEAD on Mac OS. I installed emacs-plus using the --HEAD argument with homebrew.

I did a whole grep for (package-initialize) in ~/.emacs.d/. The only reference I found to it is in elpa/flycheck, and I odn't require it at all, so it shouldn't run. Just to be safe, I customize the flycheck-emacs-lisp-initialize-packages variable to nil, meaning that flycheck shouldn't run package-initialize at all.

Is there anything I'm missing? Is there another place I should be checking?

4
  • Have you tried removing all byte-compiled files? They could be out of date, and one of them could have a call to that function.
    – user12563
    Jul 14, 2019 at 12:50
  • Where is your init file?
    – phils
    Jul 14, 2019 at 13:14
  • I deletd all of my own byte-compiled files (I used rm *.elc in the directory with all my .el files). Also, my init file is in ~/.emacs.d/init.el. Jul 14, 2019 at 13:52
  • Go to its source through, eg. C-h package-initialize and then RET on the link to the file. Then instrument it for debugging, I think it's C-u C-M-x or something like that. Then, re-evaluate your init file. When you enter debugger, you can examine the backtrace, and, hopefully, locate the call, most likely it is caused indirectly by something in another package.
    – wvxvw
    Jul 14, 2019 at 15:33

2 Answers 2

4

Thanks to the comment by @wvxvw, this is how I finally ended up solving the problem.

Initially, I tried going to package-initialize, and instrumenting it (by pressing C-u C-M-x) which causes it to open the debugger whenever it's called. Unfortunately, evaluating my init file by opening it and running M-x eval-buffer <RET> didn't cause the debugger to open. I guess this is because the piece of code that calls package-initialize was not being called any more.

So I put this at the top of my init file:

(debug-on-entry 'package-initialize)

Then I restarted Emacs and voila! I finally saw the debugger, which pointed me to the emacspeak package

I've already reported this to the author, but I'll go ahead and ignore this for now.

1

I had the same problem, and the solution was pretty simple.

I checked my .emacs file (the init file with all my customization), and found that I had entered

(package-initialize)

twice.

So I commented out the first one by

;; (package-initialize)

and the error went away.

1
  • Actually had the same issue. Uncommented the first one. But maybe a bit more background: "This (package-initialize) must come before configurations of installed packages." That was the issue that I had the first (package-initialize) before installing packages and one after installing the packages.
    – Pandian Le
    May 3, 2021 at 18:52

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.