[slime-cvs] CVS slime

heller heller at common-lisp.net
Tue Dec 5 12:57:57 UTC 2006


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv16931

Modified Files:
	swank-backend.lisp 
Log Message:
(guess-external-format): Return nil if the file can't be opened.
Previusly we wrongly read from stdin.


--- /project/slime/cvsroot/slime/swank-backend.lisp	2006/11/19 21:33:03	1.109
+++ /project/slime/cvsroot/slime/swank-backend.lisp	2006/12/05 12:57:57	1.110
@@ -421,21 +421,22 @@
   (with-open-file (s filename :if-does-not-exist nil
                      :external-format (or (find-external-format "latin-1-unix")
                                           :default))
-    (or (let* ((line (read-line s nil))
-               (p (search "-*-" line)))
-          (when p
-            (let* ((start (+ p (length "-*-")))
-                   (end (search "-*-" line :start2 start)))
-              (when end
-                (%search-coding line start end)))))
-        (let* ((len (file-length s))
-               (buf (make-string (min len 3000))))
-          (file-position s (- len (length buf)))
-          (read-sequence buf s)
-          (let ((start (search "Local Variables:" buf :from-end t))
-                (end (search "End:" buf :from-end t)))
-            (and start end (< start end)
-                 (%search-coding buf start end)))))))
+    (if s 
+        (or (let* ((line (read-line s nil))
+                   (p (search "-*-" line)))
+              (when p
+                (let* ((start (+ p (length "-*-")))
+                       (end (search "-*-" line :start2 start)))
+                  (when end
+                    (%search-coding line start end)))))
+            (let* ((len (file-length s))
+                   (buf (make-string (min len 3000))))
+              (file-position s (- len (length buf)))
+              (read-sequence buf s)
+              (let ((start (search "Local Variables:" buf :from-end t))
+                    (end (search "End:" buf :from-end t)))
+                (and start end (< start end)
+                     (%search-coding buf start end))))))))
 
 (defun %search-coding (str start end)
   (let ((p (search "coding:" str :start2 start :end2 end)))




More information about the slime-cvs mailing list