All Manuals > LispWorks IDE User Guide > 3 Common Features

NextPrevUpTopContentsIndex

3.7 Displaying packages

Symbols can be displayed either with their package information attached or not. In the LispWorks IDE, symbols are displayed with the package name attached by default.

For example, suppose you have created a package FOO which includes a symbol named bar and a symbol named baz. Suppose further that you created a new package FOO2, which used the FOO package. This can be done as shown below:

(defpackage foo (:use "COMMON-LISP"))
(defpackage foo2 (:use "FOO" "COMMON-LISP"))

Note that in defining both packages, the COMMON-LISP package has also been used. It is good practice to use this package, to ensure that commonly-used symbols are available.

When creating packages which use other packages, exported symbols can be called without having to refer to the package name.

To illustrate this, let us return to our example.

Figure 3.6 Two example packages

We have two packages: FOO1 and FOO2. FOO1 contains symbols bar and baz. The symbol bar has been exported, whereas the symbol baz is not exported.

When the current package is FOO2, you can refer to bar without using the package name. This is because FOO2 uses FOO1 and bar is exported. However to refer to baz you must still use the FOO1 package name like this: foo1::baz. This is because baz is not exported.

Note also that when the current package is other than FOO1 or FOO2, you can refer to foo1:bar, but you can only refer to baz as foo1::baz.

Package names are usually displayed alongside symbols in a list. Having a package entry on every line can be unhelpful, especially if the majority of items listed are from the same package. To hide the package names for the symbols in a given type of tool:

  1. Raise the Preferences dialog as described in Setting preferences.
  2. Select the tool type in the list on the left side of the dialog.
  3. Uncheck Show Package Names in the General tab.
  4. Click OK to confirm your setting.

3.7.1 Specifying a package

If you are working in a particular package, you can adjust the tools to display symbols as you would refer to them from that package - that is, as the package sees them. This can make listings clearer and, more importantly, can show you which symbols have been exported from a package.

Doing this changes the process package of the tool. This means that both displayed symbols and symbols typed into the tool are assumed to be in the package specified. This can be useful in a browser, for example, if you intend to browse a number of different objects which come from the same package.

To change the process package for a given type of tool:

  1. Raise the Preferences dialog as described in Setting preferences.
  2. Select the tool type in the list on the left side of the dialog.
  3. Select the General tab on the right side of the dialog, if necessary.
  4. Delete the package name in the Package box, and type in the name of the new package.
  5. Click to confirm this new name.
  6. Click OK to make the change.

Note: If you wish, you can partially type the package name and then click . This allows you to select from a list of all package names which begin with the partial input you have entered. See Completion for detailed instructions on using completion.

As an example, imagine you are looking at a list of symbols in the Inspector. You are working in the package FOO, and some of the symbols in the Inspector are in that package, while others are in another package. To change the current package of the Inspector to FOO, follow the instructions below:

  1. Raise the Preferences dialog as described in Setting preferences.
  2. The Preferences dialog indicates that COMMON-LISP-USER is the current package in this window.

  3. Select Inspector in the list on the left side of the dialog.
  4. In the Package box on the right side of the dialog, delete COMMON-LISP-USER, and type FOO.
  5. Click OK to make the change.

In the Inspector all the symbols available from FOO appear without the package prefix FOO. Similarly, all exported symbols in packages which FOO uses appear without a package prefix, while all others have an appropriate package prefix.


LispWorks IDE User Guide (Windows version) - 13 Sep 2017

NextPrevUpTopContentsIndex