Subject: bug#34954: 26.1.92; eshell gets loaded twice

From: Mauro Aranda <[email-masked]>
Date: Wed, 27 Mar 2019 10:51:13 -0300

Sorry for the noise, I forgot to keep [email-masked]

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.

> Frankly all foo-load-hooks are probably historical baggage that should
> be obsoleted. There's no need for them to exist given that a general
> solution does.

Anyway, my recipe was meant to provide evidence that eshell gets loaded
twice.  That still happens, either eshell-load-hook or
with-eval-after-load is used in real code.  It would be good to solve
that double loading.  That way, either eshell-load-hook (until it is
obsoleted, if it eventually happens) or with-eval-after-load (any order
of execution) can be used.

Best Regards,
Mauro.

El mié., 27 mar. 2019 a las 9:31, Glenn Morris (<[email-masked]>) escribió:

>
> For the specific issue of the load-hook, see
> https://debbugs.gnu.org/24491#8
>