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

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

Re: Requiring elisp that comes with Emacs


From: Óscar Fuentes
Subject: Re: Requiring elisp that comes with Emacs
Date: Tue, 31 Jan 2017 15:39:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Narendra Joshi <narendraj9@gmail.com> writes:

>>     What happens when we do `require'?
>>
>>
>> It guarantees the relevant feature is available, generally as a side
>> effect of loading the named package. I believe the package much
>> "provide" its name. If not found, an error is raised. Full details
>> can be found here:
>>
>> https://www.gnu.org/software/emacs/manual/html_node/elisp/
>> Named-Features.html
>
> My question was more about whether we need to `require` packages that
> come with Emacs itself, e.g. org-mode.

Emacs comes with lots of packages. A typical user only needs a fraction
of those packages. Every package takes some time to load and then uses
resources. Loading everything by default would be a waste.

Another reason for explicitly requiring a package such as `vc' (which
typically is automatically loaded when certain conditions are met) is to
ensure that certain functions and/or variables are available because you
use them in your code (in your .emacs, for instance).

>> While under the covers I imagine the implementation is much
>> different, I my mental model is similar to Python's import statement
>> or C++'s namespace statement. All three make a series of names
>> available to you, though require is a global operation, not local to
>> a particular module or translation unit.
>
> I think every file in the `load-path' would need to be read for a
> (provide 'something) at the end while trying to
> (require 'something). Languages that make sure that the name of the
> module is the same as the name of the file do not have to look inside
> the file. This is all speculation and I do not know how exactly things
> are done in reality.

Type

C-h f require [ENTER]

A *Help* buffer will popup with the docstring for `require'. There it is
explained that the file for the require-d package is inferred from the
package name.




reply via email to

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