Didier Verna writes:
Jeff Mincy <jmincy(a)muniversal.com> wrote:
Is there some standard way to do initializations like these (that
require that the file be loaded first) without causing the file to
be loaded? Basically what I want is a load-hook, but most packages
do not have load hooks (comint has one).
A couple of people suggested using eval-after-load.
Thanks - I wasn't aware of the function.
I appropos searched for the feature on provide,
since that's where I thought the feature should be.
I didn't think about load. Interestingly enough,
the comment with eval-after-load provides the rationale.
from subr.el:
================
;; This was not present before. I think Jamie had some objections
;; to this, so I'm leaving this undefined for now. --ben
;;; The objection is this: there is more than one way to load the same file.
;;; "foo", "foo.elc", "foo.el", and
"/some/path/foo.elc" are all different
;;; ways to load the exact same code. `eval-after-load' is too stupid to
;;; deal with this sort of thing. If this sort of feature is desired, then
;;; it should work off of a hook on `provide'. Features are unique and
;;; the arguments to (load) are not. --Stig
;; We provide this for FSFmacs compatibility, at least until we devise
;; something better.
(defun eval-after-load ....)
================
But in many cases, using Custom is more elegant.
15 years ago, when I started using zmacs we didn't
have any woosie customize. All we had was setq and fset....
-jeff