all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: (require 'filename) doesn't find the file
Date: Fri, 10 Mar 2017 10:55:10 +0100	[thread overview]
Message-ID: <20170310095510.GD29132@tuxteam.de> (raw)
In-Reply-To: <20170310093829.GA3918@workstation>

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

On Fri, Mar 10, 2017 at 10:38:29AM +0100, hector wrote:
> >From the Emacs lisp manual:
>      If loading the file succeeds but does not provide FEATURE,
>      `require' signals an error, `Required feature FEATURE was not
>      provided'.
> 
> This part is a bit obscure. So, it does what I want (loading the file)
> but signals an error? I don't get it.
> 
> So is it bad practice to use the file name as a feature like
> "(require 'filename)"?

No. That means, that somewhere, in the path following the (require ...),
there must be a corresponding (provide ...) *unless* something went
wrong.

Typically, the last line of "filename.el" just says (provide 'filename),
but this is just one (the most common) way of doing things.

Think like "filename.el" saying "yep, all went well, now you have
feature 'filename".

As to why this makes sense... (a) other code can ask "do we have this
feature?" (and possibly offer the user alternatives, or an apology,
or hints, or whatever) -- and (b) caching: require itself just skips
loading the file when we've got the feature. No need to load the
file one thousand times when there are thousand packages out there
depending on it.

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

iEYEARECAAYFAljCd/4ACgkQBcgs9XrR2kY6wgCeOOu+nJAcKVprRHpBIYVr8wZz
XegAn3ZAqbHpFy4kj4Fq2xqU9OvxqdJS
=wXIQ
-----END PGP SIGNATURE-----



      reply	other threads:[~2017-03-10  9:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10  9:17 (require 'filename) doesn't find the file hector
2017-03-10  9:37 ` tomas
2017-03-10 10:26   ` hector
2017-03-10 10:46     ` tomas
2017-03-10  9:38 ` hector
2017-03-10  9:55   ` tomas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170310095510.GD29132@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.