Re: Emacs per-package startup files
Erick Branderhorst writes:
>
> > If the files there really depend on each other, then it may be nice
> > to require that each xxxx.el file contains
> >
> > (provide 'site-start-xxx)
> >
> > (as the *last* line so nothing is provided in case of error), and other
> > files will just use
> >
> > (require 'site-start-xxx)
> >
> > as needed.
>
> Nice of course but now it happens that package A require stuff from B to be
> loaded, but this code for A is always executed before the stuff from B is
> executed and so A fails unless, the load process is run again and checks are
> made whether something needs to be loaded or if it has been loaded in an
> earlier run.
That's wrong. If A requires stuff from B we'll have something like:
; package a
(require 'site-start-b)
; do things here...
(provide 'site-start-a)
and
; package b
; do things here...
(provide 'site-start-b)
Now whatever the order packages are loaded, it works. If we load a, we
get
- a starts interpreting
- a requires b
-> b starts interpreting
-> b ends providing site-start-b, so a's require is fullfilled
- a continues interpreting
- a ends providing site-start-a
and if b was already loaded b is not loaded again.
The only problem would be with circular dependencies, but then nothing
can help you in such cases...
Yves.
P.S.: Erick, I read the list. No need to send emails twice.
Reply to: