slime / slime

The Superior Lisp Interaction Mode for Emacs
http://common-lisp.net/project/slime/
1.9k stars 336 forks source link

SLIME gets confused by (in-package x) inside #|...|# #558

Open cgay opened 4 years ago

cgay commented 4 years ago

SLIME version cd8cc3c95c3391b1f1cffa9e100336250a4509a7

The subject pretty much says it all. If you have a file of the form

(in-package :my-package)

#|
;; a bunch of code that includes
(cl:in-package :other-package)
|#

SLIME will think the code is in :other-package. M-. will get confused.

j3pic commented 2 months ago

SLIME's package-parsing logic has an even bigger problem, but it's related to this one.

Today, I was M-.-ing my way through the CFFI-GROVEL library. At line 206 of grovel.lisp there is a case form that checks if a variably is the symbol in-package, and if it is, it calls a setf form. But that case branch superficially looks like an in-package form, so SLIME assumes it is.

I isolated that particular aspect of SLIME's in-package processing. This will cause a ^J to appear in the package name in the buffer's title:

(in-package
  :cl-user)

SLIME should be ignoring the in-package form in grovel.lisp because it occurs within a function, and it should be accounting for the fact that in-package is an ordinary function, so its argument doesn't have to be a literal. Forms that compute the package at load time ought to work, or at least not trick SLIME into thinking that a SETF form is literally the name of a package.