8.12.4 Packages

Each buffer has a package associated with it, known as the primary package. If there is anin-package command at the top of a file when it is first read in, this is taken to specify the primary package; otherwise it is taken to beNIL. If the primary package has not already been seen by the environment, you are prompted for its creation. The primary package is shown in the message line at the bottom of the editor window.

When evaluating parts of the current buffer (as opposed to all of it), the environment ignores the primary package of the buffer and tries to find the current package within the section of code which is being evaluated. This is done so that any occurrences ofin-package in the buffer (other than on the first line) can be allowed for -- if the current package was always assumed to be the primary package of the current buffer, many sections of code would evaluate wrongly.

This means that you do not have to worry about setting the package explicitly in the listener before evaluating part of a buffer.