[slime-devel] Re: (newbie) problem with packages under slime+cmucl (bug?)

Marco Baringer mb at bese.it
Fri Jan 9 18:58:20 UTC 2004


[sorry for luke who is getting this twice]

i found a possible bug in swank:eval-region where the package was being 
re-bound outside of the scope of test to see if the package had 
changed, the attached patch fixes this and makes the corrects the 
problem (for me at least). what i find strange is that if this "bug' 
really is a bug then how does slime work at all?

Index: swank.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank.lisp,v
retrieving revision 1.88
diff -u -d -u -r1.88 swank.lisp
--- swank.lisp	8 Jan 2004 07:02:20 -0000	1.88
+++ swank.lisp	9 Jan 2004 18:49:22 -0000
@@ -471,21 +471,21 @@
      (force-output)
      (format-values-for-echo-area values)))

-(defun eval-region (string &optional package-update-p)
+(defun eval-region (string &optional (package-update-p t))
    "Evaluate STRING and return the result.
  If PACKAGE-UPDATE-P is non-nil, and evaluation causes a package
  change, then send Emacs an update."
-  (unwind-protect
-      (do ((*package* *buffer-package*)
-	   (str-length (length string))
-	   (pos 0)
-	   (form nil)
-	   (return-value nil (multiple-value-list (eval form))))
-	  ((= pos str-length) (values return-value form))
-	(multiple-value-setq (form pos)
-	  (read-from-string string nil nil :start pos)))
-    (when (and package-update-p (not (eq *package* *buffer-package*)))
-      (send-to-emacs (list :new-package (shortest-package-nickname 
*package*))))))
+  (let ((*package* *buffer-package*))
+    (unwind-protect
+        (do ((str-length (length string))
+             (pos 0)
+             (form nil)
+             (return-value nil (multiple-value-list (eval form))))
+            ((= pos str-length) (values return-value form))
+          (multiple-value-setq (form pos)
+            (read-from-string string nil nil :start pos)))
+      (when (and package-update-p (not (eq *package* 
*buffer-package*)))
+        (send-to-emacs (list :new-package (shortest-package-nickname 
*package*)))))))

  (defun shortest-package-nickname (package)
    "Return the shortest nickname (or canonical name) of PACKAGE."

--
Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen


--
Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen





More information about the slime-devel mailing list