(in-package :clim-user) (define-application-frame zoo () () (:pointer-documentation t) (:panes (io :interactor :width 800 :height 600)) (:layouts (default io))) (defun zoo () (run-frame-top-level(make-application-frame'zoo))) (define-presentation-type form ()) (defvar *delimiter* "() ") (define-presentation-method accept ((type form) stream (view textual-view) &key (default nil defaultp) default-type) (let ((g (read-gesture :stream stream))) (print g *trace-output*) (finish-output *trace-output*) (case g (#\space (accept type :stream stream :prompt nil)) ;again (#\( (let ((res nil)) (do ((c (read-gesture :stream stream) (read-gesture :stream stream))) ((eql c #\) ) (reverse res)) (unread-gesture c :stream stream) (push (accept 'form :stream stream :provide-default nil :prompt nil) res)))) (otherwise (read-from-string (with-output-to-string (bag) (princ g bag) (do ((c (read-gesture :stream stream) (read-gesture :stream stream))) ((find c *delimiter*) (unread-gesture c :stream stream)) (princ c bag)))) )))) (define-zoo-command (com-e :name "e") ((x 'form)) (print x)) ;; To expose the bug: ;; Type E (foo (bar ;; this activates the input and returns FOO