Hello Glenn.
> For the specific issue of the load-hook, see https://debbugs.gnu.org/24491#8
Sorry I missed that bug report. Could both reports be merged?
> You ought to be able to avoid such problems by using
> (with-)eval-after-load instead of foo-load-hook, since the former runs
> after provide (effectively).
Your recommendation works, but only if the order is:
(require 'eshell)
(with-eval-after-load "eshell" (insert "Eshell was loaded.\n")
When the order is:
(with-eval-after-load "eshell" (insert "Eshell was loaded.\n")
(require 'eshell)
The string is inserted twice, because eshell is loaded twice.
Is the former order recommended over the latter? Mandatory? I can't
find that information on the manual.
Of course, if I eval (starting from emacs -Q):
(with-eval-after-load 'eshell (insert "Eshell was loaded.\n")
And then type `M-x eshell' I get the repeated string inserted, because
again, eshell is loaded twice.