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

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

Re: (require 'filename) doesn't find the file


From: tomas
Subject: Re: (require 'filename) doesn't find the file
Date: Fri, 10 Mar 2017 11:46:30 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Mar 10, 2017 at 11:26:31AM +0100, hector wrote:
> On Fri, Mar 10, 2017 at 10:37:49AM +0100, tomas@tuxteam.de wrote:
> > It finds the file. But the file doesn't keep its promise of "providing"
> > the feature.
> > 
> > See it this way: a "require"d file might find out that something is
> > broken. Then it would return without "provide"-ing the feature, to
> > signal that sorry, this feature isn't available after all.
> > 
> > In short: just end your file with (provide 'basename), as you noticed
> > up there. Or do you see a problem with that?
> 
> No problem at all. But I see a problem in that function require doesn't
> behave as its documentation says it does. Or I just don't understand it,
> which is worse.
> 
> OK, let's widen the picture frame.
> 
> I have 2 files: required.el and requiring.el.
> 
> required.el contains:
> 
> (defvar var1 "Value"
>   "This variable is used by \"requiring.el\"")
> 
> Them, since requiring.el uses this variable, I write:
> 
> (require 'required)
> 
> expecting that "required.el" to be loaded at run time.
> 
> I'm afraid this is not the right approach. Perhaps both files should be
> put together. Or use (load "required.el") instead. I just don't know.

Your expectation *is* right (assuming paths and things align correctly).

The only missing bit in that picture is for the file "required.el" to
contain one last line

  (provide 'required)

Is the doc unclear about that? (sorry, no time now to check -- ping me
again if you want me to, probly this afternoon)

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAljChAYACgkQBcgs9XrR2kaioQCfRP/FD3UValPdQ1i5JqtZyUSo
jqAAnjZU4sq0f+qE5IMuE1eoqTy929/i
=8zTZ
-----END PGP SIGNATURE-----



reply via email to

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