[slime-cvs] CVS update: slime/swank-sbcl.lisp

Luke Gorrie lgorrie at common-lisp.net
Tue Jul 20 00:42:14 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv9097

Modified Files:
	swank-sbcl.lisp 
Log Message:
(call-with-compilation-hooks): Trap and report errors that cause
compilation to fail, e.g. read errors.

Date: Mon Jul 19 17:42:14 2004
Author: lgorrie

Index: slime/swank-sbcl.lisp
diff -u slime/swank-sbcl.lisp:1.95 slime/swank-sbcl.lisp:1.96
--- slime/swank-sbcl.lisp:1.95	Tue Jul 13 11:14:03 2004
+++ slime/swank-sbcl.lisp	Mon Jul 19 17:42:14 2004
@@ -176,7 +176,8 @@
                        (sb-c:compiler-error  :error)
                        (sb-ext:compiler-note :note)
                        (style-warning        :style-warning)
-                       (warning              :warning))
+                       (warning              :warning)
+                       (error                :error))
            :short-message (brief-compiler-message-for-emacs condition)
            :references
            ;; FIXME: delete the reader conditionaloid after sbcl
@@ -278,22 +279,27 @@
 
 (defimplementation call-with-compilation-hooks (function)
   (declare (type function function))
-  (handler-bind ((sb-c:compiler-error  #'handle-notification-condition)
+  (handler-bind ((sb-c:fatal-compiler-error #'handle-file-compiler-termination)
+                 (sb-c:compiler-error  #'handle-notification-condition)
                  (sb-ext:compiler-note #'handle-notification-condition)
                  (style-warning        #'handle-notification-condition)
                  (warning              #'handle-notification-condition))
     (funcall function)))
 
+(defun handle-file-compiler-termination (condition)
+  "Handle a condition that caused the file compiler to terminate."
+  (handle-notification-condition
+   (sb-int:encapsulated-condition condition)))
+
 (defvar *trap-load-time-warnings* nil)
 
 (defimplementation swank-compile-file (filename load-p)
-  (flet ((loadit (fasl-file) (when (and load-p fasl-file) (load fasl-file))))
-    (cond (*trap-load-time-warnings*
-           (with-compilation-hooks ()
-             (loadit (compile-file filename))))
-          (t
-           (loadit (with-compilation-hooks () 
-                     (compile-file filename)))))))
+  (handler-case
+      (let ((output-file (with-compilation-hooks ()
+                           (compile-file filename))))
+        (when (and load-p output-file)
+          (load output-file)))
+    (sb-c:fatal-compiler-error () nil)))
 
 (defimplementation swank-compile-string (string &key buffer position)
   (let ((form (read-from-string (format nil "(~S () ~A)" 'lambda string))))





More information about the slime-cvs mailing list