fix escapes in REPL when using :WRAP-CURRENT T
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 30 Aug 2011 07:27:20 +0000 (10:27 +0300)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 30 Aug 2011 07:29:18 +0000 (10:29 +0300)
  I have no idea what I was thinking when I put the
  META-ESCAPE crap in there.

  Also delete a bunch of trailing whitespace.

ports/sbcl.lisp
utility-functions.lisp

index 929cc95..61057e6 100644 (file)
@@ -1,5 +1,5 @@
-;; Copyright (c) 2003 Nikodemus Siivola
-;; 
+;; Copyright (c) 2003, 2011 Nikodemus Siivola <nikodemus@random-state.net>
+;;
 ;; Permission is hereby granted, free of charge, to any person obtaining
 ;; a copy of this software and associated documentation files (the
 ;; "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
 ;; distribute, sublicense, and/or sell copies of the Software, and to
 ;; permit persons to whom the Software is furnished to do so, subject to
 ;; the following conditions:
-;; 
+;;
 ;; The above copyright notice and this permission notice shall be included
 ;; in all copies or substantial portions of the Software.
-;; 
+;;
 ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 ;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 ;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -60,7 +60,7 @@ preserved with the :WRAP-CURRENT T."
                 (handler-case
                     (linedit:formedit
                      :prompt1 prompt
-                     :prompt2 (make-string (length prompt) 
+                     :prompt2 (make-string (length prompt)
                                            :initial-element #\Space))
                   (end-of-file (e)
                     (if eof-quits
@@ -68,18 +68,18 @@ preserved with the :WRAP-CURRENT T."
                         ;; Hackins, I know.
                         "#.''end-of-file"))))))
        (setf sb-int:*repl-prompt-fun* (constantly ""))
-       (setf sb-int:*repl-read-form-fun*             
+       (setf sb-int:*repl-read-form-fun*
              (if wrap-current
                  (lambda (in out)
                    (declare (type stream out in))
                      ;; FIXME: Yich.
                    (terpri)
-                   (with-input-from-string (in (meta-escape (repl-reader in out)))
+                   (with-input-from-string (in (repl-reader in out))
                      (funcall read-form-fun in out)))
                  (lambda (in out)
                    (declare (type stream out in))
                    (handler-case (read-from-string (repl-reader in out))
-                     (end-of-file () 
+                     (end-of-file ()
                        ;; We never get here if eof-quits is true, so...
                        (fresh-line)
                        (write-line "#<end-of-file>")
index f6e79b4..d6a1ca8 100644 (file)
@@ -69,20 +69,6 @@ open-args passed to `open'."
   "Like min, except ignores NILs."
   (apply #'min (remove-if #'null args)))
 
-(defun meta-escape (string)
-  (declare (simple-string string))
-  (let (stack)
-    (loop with last
-         for i from 1 upto (length string)
-         for char across string
-         ;; KLUDGE: Deal with character literals. Not quite sure this is
-         ;; the right and robust way to do it, though.
-         when (and (eql #\\ char) (not (eql #\# last)))
-         do (push #\\ stack)
-         do (push char stack)
-            (setf last char))
-    (coerce (nreverse stack) 'simple-string)))
-
 (defun eof-handler (lisp-name quit-fn)
   (handler-case
       (loop