[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add code from other files
From: |
uzibalqa |
Subject: |
Re: Add code from other files |
Date: |
Thu, 04 Jul 2024 17:32:31 +0000 |
Sent with Proton Mail secure email.
On Thursday, July 4th, 2024 at 5:16 PM, uzibalqa <uzibalqa@proton.me> wrote:
> On Thursday, July 4th, 2024 at 12:10 PM, uzibalqa uzibalqa@proton.me wrote:
>
> > On Thursday, July 4th, 2024 at 11:19 AM, uzibalqa uzibalqa@proton.me wrote:
> >
> > > On Thursday, July 4th, 2024 at 11:11 AM, Basile Starynkevitch
> > > basile@starynkevitch.net wrote:
> > >
> > > > On 7/4/24 13:03, uzibalqa wrote:
> > > >
> > > > > On Thursday, July 4th, 2024 at 3:49 AM, Basile Starynkevitch
> > > > > basile@starynkevitch.net wrote:
> > > > >
> > > > > > On 7/4/24 01:44, uzibalqa wrote:
> > > > > >
> > > > > > > I have a file and want to add the code from other files to it.
> > > > > > > What does one do ?
> > > > > >
> > > > > > You should explain more. Are you thinking of Elisp code? GNU emacs
> > > > > > can
> > > > > > be used to edit non-code files (eg LaTeX documents)
> > > > > >
> > > > > > --
> > > > > > Basile STARYNKEVITCH basile@starynkevitch.net
> > > > > > I have an elisp file and want to include the functionality present
> > > > > > in another .el file.
> > > >
> > > > Can't you use the load primitive function of Elisp
> > > >
> > > > > load is a primitive-function in ‘C source code’.
> > > > >
> > > > > (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)
> > > > >
> > > > > Execute a file of Lisp code named FILE.
> > > > > First try FILE with ‘.elc’ appended, then try with ‘.el’, then try
> > > > > with a system-dependent suffix of dynamic modules (see
> > > > > ‘load-suffixes’),
> > > > > then try FILE unmodified (the exact suffixes in the exact order are
> > > > > determined by ‘load-suffixes’). Environment variable references in
> > > > > FILE are replaced with their values by calling
> > > > > ‘substitute-in-file-name’.
> > > > > This function searches the directories in ‘load-path’.
> > > > >
> > > > > If optional second arg NOERROR is non-nil,
> > > > > report no error if FILE doesn’t exist.
> > > > > Print messages at start and end of loading unless
> > > > > optional third arg NOMESSAGE is non-nil (but ‘force-load-messages’
> > > > > overrides that).
> > > > > If optional fourth arg NOSUFFIX is non-nil, don’t try adding
> > > > > suffixes to the specified name FILE.
> > > > > If optional fifth arg MUST-SUFFIX is non-nil, insist on
> > > > > the suffix ‘.elc’ or ‘.el’ or the module suffix; don’t accept just
> > > > > FILE unless it ends in one of those suffixes or includes a directory
> > > > > name.
> > > > >
> > > > > If NOSUFFIX is nil, then if a file could not be found, try looking for
> > > > > a different representation of the file by adding non-empty suffixes to
> > > > > its name, before trying another file. Emacs uses this feature to find
> > > > > compressed versions of files when Auto Compression mode is enabled.
> > > > > If NOSUFFIX is non-nil, disable this feature.
> > > > >
> > > > > The suffixes that this function tries out, when NOSUFFIX is nil, are
> > > > > given by the return value of ‘get-load-suffixes’ and the values listed
> > > > > in ‘load-file-rep-suffixes’. If MUST-SUFFIX is non-nil, only the
> > > > > return value of ‘get-load-suffixes’ is used, i.e. the file name is
> > > > > required to have a non-empty suffix.
> > > > >
> > > > > When searching suffixes, this function normally stops at the first
> > > > > one that exists. If the option ‘load-prefer-newer’ is non-nil,
> > > > > however, it tries all suffixes, and uses whichever file is the newest.
> > > > >
> > > > > Loading a file records its definitions, and its ‘provide’ and
> > > > > ‘require’ calls, in an element of ‘load-history’ whose
> > > > > car is the file name loaded. See ‘load-history’.
> > > > >
> > > > > While the file is in the process of being loaded, the variable
> > > > > ‘load-in-progress’ is non-nil and the variable ‘load-file-name’
> > > > > is bound to the file’s name.
> > > > >
> > > > > Return t if the file exists and loads successfully.
> > > > >
> > > > > Probably introduced at or before Emacs version 1.1.
> >
> > What are the 'provide' and 'require' calls and should I use them ?
> > When is it appropriate to use 'load'. A useful feature of load is
> > that prints messages at start and end of loading.
I have a main file and three auxiliary files. I can use `load` for the auxiliary
files and use `provide` for the main file. Would this be the correct approach ?
This approach ensures that all auxiliary files are loaded when the main file is
loaded,
and that the main file can be required as a single unit.
- Add code from other files, uzibalqa, 2024/07/03
- Message not available
- Message not available
- Message not available
- Message not available
- Re: Add code from other files, uzibalqa, 2024/07/04
- Re: Add code from other files, uzibalqa, 2024/07/04
- Re: Add code from other files,
uzibalqa <=
- Re: Add code from other files, Emanuel Berg, 2024/07/04
- Re: Add code from other files, uzibalqa, 2024/07/04
- Re: Add code from other files, Emanuel Berg, 2024/07/07
- RE: [External] : Re: Add code from other files, Drew Adams, 2024/07/04
- RE: [External] : Re: Add code from other files, uzibalqa, 2024/07/04
- RE: [External] : Re: Add code from other files, uzibalqa, 2024/07/04
- RE: [External] : Re: Add code from other files, uzibalqa, 2024/07/05
- Re: [External] : Re: Add code from other files, Emanuel Berg, 2024/07/07