[mcclim-cvs] CVS mcclim/Apps/Listener

ahefner ahefner at common-lisp.net
Sun Feb 3 10:18:34 UTC 2008


Update of /project/mcclim/cvsroot/mcclim/Apps/Listener
In directory clnet:/tmp/cvs-serv13022

Modified Files:
	listener.lisp 
Log Message:
Handle empty input.


--- /project/mcclim/cvsroot/mcclim/Apps/Listener/listener.lisp	2008/02/01 18:48:56	1.39
+++ /project/mcclim/cvsroot/mcclim/Apps/Listener/listener.lisp	2008/02/03 10:18:32	1.40
@@ -133,14 +133,23 @@
 
 ;;; Lisp listener command loop
 
+(define-presentation-type empty-input ())
+
+(define-presentation-method present 
+    (object (type empty-input) stream view &key &allow-other-keys)
+  (princ "" stream))
+
 (defmethod read-frame-command ((frame listener) &key (stream *standard-input*))  
   "Specialized for the listener, read a lisp form to eval, or a command."
   (multiple-value-bind (object type)
       (let ((*command-dispatchers* '(#\,)))
-        (accept 'command-or-form :stream stream :prompt nil :default nil))
-    (if (presentation-subtypep type 'command)
-        object
-        `(com-eval ,object))))
+        (accept 'command-or-form :stream stream :prompt nil :default "hello" :default-type 'empty-input :insert-default nil))
+    (cond      
+      ((presentation-subtypep type 'empty-input)
+       ;; Do nothing.
+       `(com-eval (values)))
+      ((presentation-subtypep type 'command) object)
+      (t `(com-eval ,object)))))
 
 (defun print-listener-prompt (stream frame)
   (declare (ignore frame))




More information about the Mcclim-cvs mailing list