Menu

#3 Buffer package detected incorrectly

open
nobody
None
5
2002-02-08
2002-02-08
Anonymous
No

In the file ilisp-snd.el ($Id: ilisp-snd.el,v 1.10
2001/05/12 22:10:53 marcoxa Exp $), the function
lisp-find-hash-form contains the following code:

(cond ((or (prog1
(string-match in-package-regexp found)
(setq in-package-found-p t))
(string-match defpackage-regexp found))
...))

This unconditionally sets the variable
in-package-found-p to t. I believe the "prog1" should
have been "and".

in-package-found-p is a dynamic variable bound from
lisp-buffer-package-internal, and the code above makes
the latter function believe the first hash-form in any
file must be its package declaration. Consider the
following example file:

--------
#+ignore
(declare (special *x*))
(in-package :some-package)
--------
M-x lisp-buffer-package-internal says
Buffer package: "COMMON-LISP-USER",
which is wrong. #+ignore (declare ...) is correctly
detected to be the first hash-form, but it is not an
in-package form; due to the errorneous prog1 above,
lisp-buffer-package-internal is led to believe an
in-package form has been found.

If we replace "prog1" with "and", we get
Buffer package: "SOME-PACKAGE".

Discussion


Log in to post a comment.