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

Re: Packages



At  3:00 PM 10/6/93 +0000, Pete Halverson wrote:
>[...]
>Right.  Although the loader and compiler can switch *PACKAGE* values
>whenever they read an IN-PACKAGE form, the editor probably just uses the
>first IN-PACKAGE it sees; subsequent ones don't count.  I have yet to see a
>Lisp editor that recognizes multiple IN-PACKAGE forms in a buffer and bases
>the current buffer package on the current cursor position.  

That is correct. MCL looks first for a modeline package spec, then for the first
IN-PACKAGE form in the buffer (skipping a DEFPACKAGE form if there is one). You
can reparse this with c-m-m (reparse-modeline). You can also change the buffer
package by putting the cursor after an IN-PACKAGE form and typing <Enter>.

Fred does not evaluate DEFPACKAGE forms. You can, however cause a package to be
created by adding a modeline to the top of your buffer (c-m-shift-M):

;;;-*- Mode: Lisp; Package: <package-spec> -*-

<package-spec> can have one of the following forms:

;; FOO => (find-package "FOO")
;; (FOO) => (make-package "FOO" :use ())
;; (FOO (bar baz) 100) => (make-package "FOO" :USE '(BAR BAZ))
;;                        [ignore cruddy lispm size spec]
;; (FOO (bar baz)) => (make-package "FOO" :USE '(BAR BAZ)))
;; (FOO &rest x) => (apply #'make-package "FOO" x)

The modeline is parsed as a comment by LOAD and COMPILE-FILE, so if it does not
agree with the first IN-PACKAGE form, you will likely become confused.