src/debug.lisp: Write output to a well-known file.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 09:58:38 +0000 (10:58 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 6 Sep 2015 11:31:13 +0000 (12:31 +0100)
This way, Emacs can display it properly fontified in a buffer, and
refresh when it gets changed, rather than having an enormous dump of
text in the middle of a REPL session.

src/debug.lisp

index e281397..af5f104 100644 (file)
@@ -25,6 +25,9 @@
 
 (cl:in-package #:sod)
 
+(export '*debugout-pathname*)
+(defvar *debugout-pathname* #p"debugout.c")
+
 (export 'test-module)
 (defun test-module (path reason)
   "Reset the translator's state, read a module from PATH and output it with
   (unless *builtin-module* (make-builtin-module))
   (clear-the-decks)
   (setf *module-map* (make-hash-table :test #'equal))
-  (with-output-to-string (out)
+  (with-open-file (out *debugout-pathname*
+                  :direction :output
+                  :if-exists :supersede
+                  :if-does-not-exist :create)
     (output-module (read-module path) reason out)))
 
 ;;;----- That's all, folks --------------------------------------------------