Next: , Previous: , Up: Packages Dictionary  


11.2.18 use-package [Function]

use-package packages-to-use &optional packaget

Arguments and Values::

packages-to-use—a designator for a list of package designators. The KEYWORD package may not be supplied.

package—a package designator. The KEYWORD package cannot be supplied. The default is the current package.

Description::

use-package causes package to inherit all the external symbols of packages-to-use. The inherited symbols become accessible as internal symbols of package.

Packages-to-use are added to the use list of package if they are not there already. All external symbols in packages-to-use become accessible in package as internal symbols. use-package does not cause any new symbols to be present in package but only makes them accessible by inheritance.

use-package checks for name conflicts between the newly imported symbols and those already accessible in package. A name conflict in use-package between two external symbols inherited by package from packages-to-use may be resolved in favor of either symbol by importing one of them into package and making it a shadowing symbol.

Examples::

 (export (intern "LAND-FILL" (make-package 'trash)) 'trash) ⇒  T
 (find-symbol "LAND-FILL" (make-package 'temp)) ⇒  NIL, NIL
 (package-use-list 'temp) ⇒  (#<PACKAGE "TEMP">)
 (use-package 'trash 'temp) ⇒  T
 (package-use-list 'temp) ⇒  (#<PACKAGE "TEMP"> #<PACKAGE "TRASH">)
 (find-symbol "LAND-FILL" 'temp) ⇒  TRASH:LAND-FILL, :INHERITED

Side Effects::

The use list of package may be modified.

See Also::

unuse-package , package-use-list , Package Concepts

Notes::

It is permissible for a package P_1 to use a package P_2 even if P_2 already uses P_1. The using of packages is not transitive, so no problem results from the apparent circularity.


Next: , Previous: , Up: Packages Dictionary