Index: /branches/working-0711/ccl/level-1/l1-readloop-lds.lisp
===================================================================
--- /branches/working-0711/ccl/level-1/l1-readloop-lds.lisp	(revision 9601)
+++ /branches/working-0711/ccl/level-1/l1-readloop-lds.lisp	(revision 9602)
@@ -45,5 +45,5 @@
 (define-toplevel-command 
     :global y (&optional p) "Yield control of terminal-input to process
-whose name or ID matches <p>, or to any process if <p> is null"
+   whose name or ID matches <p>, or to any process if <p> is null"
     (%%yield-terminal-to (if p (find-process p))))	;may be nil
 
@@ -117,4 +117,7 @@
 
 (define-toplevel-command :global ? () "help"
+  (format t "~&The following toplevel commands are available:")
+  (when *default-integer-command*
+    (format t "~& <n>  ~8Tthe same as (~s <n>)" (car *default-integer-command*)))
   (dolist (g *active-toplevel-commands*)
     (dolist (c (cdr g))
@@ -124,5 +127,6 @@
 	(if args
 	  (format t "~& (~S~{ ~A~}) ~8T~A" command args doc)
-	  (format t "~& ~S  ~8T~A" command doc))))))
+	  (format t "~& ~S  ~8T~A" command doc)))))
+  (format t "~&Any other form is evaluated and its results are printed out."))
 
 
@@ -242,15 +246,30 @@
 (%use-toplevel-commands :global)
 
+(defparameter *toplevel-commands-dwim* t "If true, tries to interpret otherwise-erroneous toplevel
+expressions as commands")
+
+(defvar *default-integer-command* nil
+  "If non-nil, should be (keyword  min max)), causing integers between min and max to be
+  interpreted as (keyword integer)")
+
 (defun check-toplevel-command (form)
+  (when (and *default-integer-command*
+             (integerp form)
+             (<= (cadr *default-integer-command*) form (caddr *default-integer-command*)))
+    (setq form `(,(car *default-integer-command*) ,form)))
   (let* ((cmd (if (consp form) (car form) form))
          (args (if (consp form) (cdr form))))
-    (if (keywordp cmd)
+    (when (or (keywordp cmd)
+              (and *toplevel-commands-dwim*
+                   (non-nil-symbol-p cmd)
+                   (not (if (consp form) (fboundp cmd) (boundp cmd)))
+                   ;; Use find-symbol so don't make unneeded keywords.
+                   (setq cmd (find-symbol (symbol-name cmd) :keyword))))
+      (when (eq cmd :help) (setq cmd :?))
       (dolist (g *active-toplevel-commands*)
-	(when
-	    (let* ((pair (assoc cmd (cdr g))))
-	      (if pair 
-		(progn (apply (cadr pair) args)
-		       t)))
-	  (return t))))))
+        (let* ((pair (assoc cmd (cdr g))))
+          (when pair 
+            (apply (cadr pair) args)
+            (return t)))))))
 
 (defparameter *quit-on-eof* nil)
Index: /branches/working-0711/ccl/lib/ccl-export-syms.lisp
===================================================================
--- /branches/working-0711/ccl/lib/ccl-export-syms.lisp	(revision 9601)
+++ /branches/working-0711/ccl/lib/ccl-export-syms.lisp	(revision 9602)
@@ -23,4 +23,5 @@
      local
      set-local
+     @
      *elements-per-buffer*
      save-application
Index: /branches/working-0711/ccl/lib/describe.lisp
===================================================================
--- /branches/working-0711/ccl/lib/describe.lisp	(revision 9601)
+++ /branches/working-0711/ccl/lib/describe.lisp	(revision 9602)
@@ -1752,4 +1752,5 @@
 
 (defvar *inspector-ui* ())
+(defvar *previous-inspector-ui* nil)
 
 (defclass inspector-ui ()
@@ -1801,10 +1802,16 @@
 (ccl::define-toplevel-command
     :tty-inspect pop ()
-    "exit current inspector"
+    "exit current inspector level"
     (invoke-restart 'exit-inspector))
+
+(ccl::define-toplevel-command
+    :tty-inspect q ()
+    "exit inspector"
+  (invoke-restart 'end-inspect))
+
 
 (ccl::define-toplevel-command
     :tty-inspect show ()
-    "re-show currently inspected object"
+    "re-show currently inspected object (the value of CCL:@)"
     (ui-present *inspector-ui*))
 
@@ -1851,5 +1858,6 @@
 
 (defmethod ui-interact ((ui inspector-tty-ui))
-  (let* ((level (inspector-ui-level ui)))
+  (let* ((level (inspector-ui-level ui))
+         (ccl::*default-integer-command* `(:i 0 ,(1- (compute-line-count (inspector-ui-inspector ui))))))
     (restart-case
      (ccl:with-terminal-input
@@ -1860,5 +1868,8 @@
 				   (format stream "~&Inspect> ")
 				   (format stream "~&Inspect ~d> " level))))))
-     (exit-inspector () (terpri *debug-io*)))))
+      (exit-inspector () ;
+        (if *previous-inspector-ui*
+          (ui-present *previous-inspector-ui*)
+          (terpri *debug-io*))))))
 
 (defmethod inspector-ui-inspect-nth ((ui inspector-tty-ui) n)
@@ -1878,5 +1889,6 @@
 
 (defmethod inspector-ui-inspect ((ui inspector-ui))
-  (let* ((*inspector-ui* ui))
+  (let* ((*previous-inspector-ui* *inspector-ui*)
+         (*inspector-ui* ui))
     (ui-initialize ui)
     (ui-present ui)
@@ -1889,9 +1901,9 @@
 					 :level 0)))
 
-(defglobal *default-inspector-ui-creation-function* 'tty-inspect)
+(defparameter *default-inspector-ui-creation-function* 'tty-inspect)
        
 
 (defun inspect (thing)
   (let* ((ccl::@ thing))
-    (funcall *default-inspector-ui-creation-function* thing)))
-
+    (restart-case (funcall *default-inspector-ui-creation-function* thing)
+      (end-inspect () thing))))
