[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21563: 24.5; discourage load-hook variables
From: |
Stefan Kangas |
Subject: |
bug#21563: 24.5; discourage load-hook variables |
Date: |
Wed, 15 Jan 2020 21:42:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Drew Adams <drew.adams@oracle.com> writes:
>> I would suggest to declare the above variables obsolete
>> and point users to eval-after-load instead.
>
> Why? If the only reason (only one given so far) is
> that a user set a hook after loading and expected
> the hook setting to be effective, then I'd say that's
> not a great reason.
I think the idea here was mainly to get rid of redundancy. But see
below.
> And there was talk at one time of discouraging that as
> well, I believe. It's still discouraged for code that's
> to be included in Emacs - see (emacs) `Coding Standards'.
> (But see also (emacs) `Foldout'.)
>
> And see (elisp) `Hooks for Loading':
> "Normally, well-designed Lisp programs should not
> use 'with-eval-after-load'."
>
> Granted, that's about "Lisp programs" and not init
> files. Still...
>
>> Does anyone disagree with that?
>
> I think I do. I see something like `dired-load-hook'
> as a different tool than `(with-)eval-after-load'.
> Not worse or better, either generally or always.
>
> Setting or changing the explicit hook value has
> no effect if the library was already loaded, whereas
> `(with-)eval-after-load' has an immediate effect in
> that case. (Sure, the latter could test in its body
> whether it's loaded and act conditionally...)
Good point. So it seems like load-hooks and eval-after-load are
slightly different and could both be useful. In that case, I guess
this should be closed as a wontfix?
Best regards,
Stefan Kangas
- bug#21563: 24.5; discourage load-hook variables, Stefan Kangas, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables, Drew Adams, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables,
Stefan Kangas <=
- bug#21563: 24.5; discourage load-hook variables, Glenn Morris, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables, Stefan Kangas, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables, Drew Adams, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables, Stefan Kangas, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables, Drew Adams, 2020/01/15
- bug#21563: 24.5; discourage load-hook variables, Stefan Kangas, 2020/01/16
- bug#21563: 24.5; discourage load-hook variables, Drew Adams, 2020/01/16
- bug#21563: 24.5; discourage load-hook variables, Stefan Kangas, 2020/01/16
- bug#21563: 24.5; discourage load-hook variables, Drew Adams, 2020/01/16