Glynn Clements <glynn(a)sensei.co.uk> writes:
> > How about binding custom-set-* (e.g. with flet) during the
reading of
> > user-init-file, to a function which displays a warning? This could
> > suggest that the user move these entries to the new file.
>
> You can't tell which file it is being loaded from. If someone has
> changed the value of custom-file and hand loads it in .emacs they will
> now lose.
Hmm. Would it make more sense to unconditionally load whichever file
custom-file refers to?
Unfortunately not. That has been the documented price of extortion
("rename your custom file and you load it and I promise to not molest
your .emacs").
Alternatively, you could flet load-file as well.
I'm not sure how well that will work. The Work Of Satan (aka
jka-compr.el) takes liberties in the area of redefining low-level
load functions. For another example, EFS overwrites `load-file'
with `default-dir-load-file' when it is initialized.
In general, it might be useful if load-file `pushed' the current
file onto a stack of active files, e.g. so that errors could be
attributed to a particular file, similar to gcc's `In file included
from ...'.
The information is available somewhere because it gets saved in the
load-history.