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: Drew Adams
Subject: RE: [External] : Re: Add code from other files
Date: Thu, 4 Jul 2024 21:32:07 +0000

> 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.



reply via email to

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