Skip to content

Commit

Permalink
every nested invocation of FORMEDIT needs its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
nikodemus committed Jun 18, 2015
1 parent 56481c7 commit 896efa5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.lisp 100644 → 100755
Expand Up @@ -54,6 +54,8 @@
(with-backend *editor*
(edit))))))

(defvar *level* 0)

(defun formedit (&rest args &key (prompt1 "") (prompt2 "")
&allow-other-keys)
"Reads a single form of input with line-editing. Returns the form as
Expand All @@ -75,7 +77,11 @@ a string. Assumes standard readtable."
(string #\newline)
(apply #'linedit :prompt prompt2 args))))
((let ((form (handler-case (let ((*readtable* table)
(*package* (make-package "LINEDIT-SCRATCH")))
(*level* (1+ *level*))
(*package* (make-package
;; If we manage to get into a nested read,
;; make sure we don't try to use the same package.
(format nil "LINEDIT-SCRATCH#~A" *level*))))
;; KLUDGE: This is needed to handle input that starts
;; with an empty line. (At least in the presense of
;; ACLREPL).
Expand Down

0 comments on commit 896efa5

Please sign in to comment.