The renormalization of electronic eigenenergies due to electron-phonon interactions (temperature dependence and zero-point motion effect) is important in many materials. We address it in the adiabatic harmonic approximation, based on first principles (e.g., density-functional theory), from different points of view: directly from atomic position fluctuations or, alternatively, from Janak’s theorem generalized to the case where the Helmholtz free energy, including the vibrational entropy, is used. We prove their equivalence, based on the usual form of Janak’s theorem and on the dynamical equation. We then also place the Allen-Heine-Cardona (AHC) theory of the renormalization in a first-principles context. The AHC theory relies on the rigid-ion approximation, and naturally leads to a self-energy (Fan) contribution and a Debye-Waller contribution. Such a splitting can also be done for the complete harmonic adiabatic expression, in which the rigid-ion approximation is not required. A numerical study within the density-functional perturbation theory framework allows us to compare the AHC theory with frozen-phonon calculations, with or without the rigid-ion approximation. For the two different numerical approaches without non-rigid-ion terms, the agreement is better than 7 μeV in the case of diamond, which represent an agreement to five significant digits. The magnitude of the non-rigid-ion terms in this case is also presented, distinguishing specific phonon modes contributions to different electronic eigenenergies.