help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Add code from other files


From: uzibalqa
Subject: RE: [External] : Re: Add code from other files
Date: Fri, 05 Jul 2024 19:59:59 +0000

On Thursday, July 4th, 2024 at 11:20 PM, uzibalqa <uzibalqa@proton.me> wrote:

> On Thursday, July 4th, 2024 at 10:07 PM, uzibalqa uzibalqa@proton.me wrote:
> 
> > On Thursday, July 4th, 2024 at 9:32 PM, Drew Adams drew.adams@oracle.com 
> > wrote:
> > 
> > > > Use `provide' downmost in all your files, and whenever one function is 
> > > > needed in some other file, you` require' that file
> > > > first (topmost) in THAT file.
> > > > 
> > > > Is a good way to do it.
> > > > 
> > > > If you byte-compile it will tell you, if some file uses
> > > > something not defined in that file, and also not require'd
> > > > from another where it is.
> > > > 
> > > > So you can both find bugs that way and find out what needs to
> > > > be required by what.
> > > 
> > > In addition, there's this case (not too common),
> > > mentioned in (elisp) `Named Features':
> > > 
> > > Although top-level calls to 'require' are evaluated
> > > during byte compilation, 'provide' calls are not.
> > > Therefore, you can ensure that a file of definitions
> > > is loaded before it is byte-compiled by including a
> > > 'provide' followed by a 'require' for the same feature,
> > > as in the following example.
> > > 
> > > (provide 'my-feature) ; Ignored by byte compiler,
> > > ; evaluated by 'load'.
> > > (require 'my-feature) ; Evaluated by byte compiler.
> > 
> > Please do not complicate my life. Do I really need to use this not too
> > common case ?
> 
> Can someone explain to me why I should not use `load` ? What is load useful 
> for,
> but not useful in my case ?

>From what I could find,  the 'require' function is generally preferred over 
>'load' 
to avoid duplicate loading.  Still, the auxiliary files will only be used by 
the 
master file and not in other places.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]