Subject: bug#14502: 24.3; dired-load-hook should not be customizable

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 15 Aug 2019 18:29:32 -0700

(Please keep the debbugs address in the Cc header.)

Reuben Thomas <[email-masked]> writes:

>  I'm not sure I understand the problem, and #13870 does not talk about
>  `find-file-hook'.
>
> Sorry, that should say #13780. The problem is that add-hook (often in
> 3rd-party code) can be in a race with custom.el.
>
> As far as this bug report goes, if you try to customize dired-load-hook to load
> dired-x, it doesn't work.
>
>  Does it matter whether you use `add-hook' or Customize for this
>  particular hook?  Most hooks are customisable, surely, including
>  `find-file-hook'.
>
> Yes, and this can cause problems. See #13780.

The problem in #13780 is that if you mix add-hook with Customize
settings of a hook, then (depending on load order), the Customize value
for the hook may overwrite those add-hooks.  The solution proposed is
that one shouldn't have defcustoms on the hooks one may somehow expect
that packages add stuff to.

But dired-load-hook doesn't seem like one of those hooks, and if you
use Customize to be

(load-x)

where load-x is

(defun load-x ()
  (require 'dired-x))

then surely dired-x will be loaded with dired is loaded?  (Not that I've
tried myself.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no