Subject: package-install of an ELPA :core package doesn't reload in time

From: João Távora <[email-masked]>
Date: Fri, 31 Mar 2023 23:43:04 +0100

Hello,

I'm reporting this bug to Emacs as suggested by Stefan.

The original report by Jay Barra lives at
https://github.com/joaotavora/eglot/issues/1193:

A simpler reproduction can be achieved in this manner, with Emacs 28:

   HOME=`mktemp -d` && emacs -Q # ensure we have a blank ELPA package directly

   M-: (featurep 'project) ;; return nil
   M-x package-install RET eglot RET
   M-x find-library RET project RET
   M-: (featurep 'project) ;; returns t
   M-: (fboundp 'project-name) ;; return nil

The last step is a bug because the 'project.el' now shown in the window,
which _does_ contain 'project-name' is not the one that was loaded.

Instead, Emacs's 28 built-in project.el 0.8.1 was loaded.  Subsequent usage of
Eglot, which requires project 0.9.8, fails.  Restarting Emacs fixes this.

Stefan says there is some code in package.el to prevent this and
unconditionally reload the newly installed project.el.  But for some
reason it's not being triggered.

João