Re: eval-after-provision

"Stephen J. Turnbull" <[email protected]> Fri, 26 Mar 2004 12:32:06 +0900
Newsgroups gmane.emacs.xemacs.design
Organization The XEmacs Project
Message-ID <[email protected]>
>>>>> "Brian" == Brian Palmer <[email protected]> writes:

    Brian> I've been working for a while with a feature
    Brian> 'eval-after-provision' in my init file which seems like
    Brian> it'd be a useful feature to integrate into xemacs.

I like the idea.  

    Brian> From the comments in the source for eval-after-load and
    Brian> eval-when-feature, it seems like others agree with me.

When the comments are attributed, please mention who they are.

    Brian> To summarize, the trouble with e-a-l and e-w-f is that they
    Brian> work with after-load-alist.

However, `eval-after-provision' potentially has a similar problem:
some files provide multiple features, so the hook function should be
idempotent (or one-shot, somehow).  This suggests the hook function be
executed before the feature is actually provided (it can test for any
of a set of features that might have called for it).  I haven't
thought this out carefully though.

Second, there's a problem with both this and your implementation, that
`provide' is currently implemented so that it doesn't matter where in
the file you invoke it.  But if the hook function itself depends on
loaded functionality, you're going to get an error if the `provide' is
done early (as it often is when features recursively depend on each
other).

I think this can be fixed by copying the function to a list of things
to be executed after loading completes successfully.

Finally, I suspect that currently Fprovide may be called before the
Lisp interpreter is fully initialized.  That would be a "oops"!
Again, this could be fixed by delaying the execution until safe.

-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.