Commit Graph

10 Commits

Author SHA1 Message Date
Eli Barzilay
c7bf34d387 Improve macro stepper output, and some more ,stx outputs.
(cherry picked from commit 8109299ec8)
2011-07-19 16:57:07 -04:00
Eli Barzilay
36a0fea0cc XREPL tests.
Not too much, but already tests large parts of sensitive code.  Caught a
bug where ,top would use (enter! #f) but enter grabbed the wrong
namespace since it was instantiated in the wrong namespace.
(cherry picked from commit f5e53de4d9)
2011-07-19 16:57:05 -04:00
Eli Barzilay
1f7e9658a3 Fix reading a 'line argument: always succeeds and returns the line as-is.
(cherry picked from commit 09c8880ea0)
2011-07-19 11:36:24 -04:00
Eli Barzilay
4c8a6aefe7 Add $F for ,sh commands.
(cherry picked from commit 261288c394)
2011-07-19 11:36:21 -04:00
Eli Barzilay
e8d3223ce5 Add an example for extending xrepl, the very stupid way.
For the record, a way to do this permanently is to add something like
this to your ~/.racketrc:

  (eval '(begin
           (saved-values-char #\~)
           (defcommand eli "stuff" "eli says" ["Make eli say stuff"]
             (printf "Eli says: ~a\n" (getarg 'line)))
           (defcommand er #f "alias for errortrace" ["Runs errortrace"]
             (run-command 'errortrace)))
        (module->namespace 'xrepl/xrepl))

But this is too stupid even for a section that has "Hacking" in its title.

There should definitely be an organized way to do this.  This will
require several things:

* A decent API for doing these things for user code.  (So the above
  `eval' turns to a `require' for your file which uses this API.)  This
  goes beyond just documenting what's in there -- there are issues to
  resolve like some argument reading protocol (separating the
  declaration of argument types from the command implementation code),
  so a new command can call another with arguments that it reads.

* There should also be some ,set command for customization
  options (reading and changing) and code to use the preference file for
  doing that.  I almost started to do this, but currently there are only
  three values that this could apply to (`saved-values-char', `-number',
  and `wrap-column' (which might be better to dump and use
  `pretty-print-columns' instead)).

* Also, it might be nice to have some command to do the same for simple
  aliases.  (But this might get into shady parsing issues if it's more
  than just "I want `foo' to be an alias for an existing `bar' command".)
(cherry picked from commit 3c1e624916)
2011-07-19 11:36:17 -04:00
Eli Barzilay
f8974781fe XREPL documentation.
(cherry picked from commit d7c14cbd3f)
2011-07-19 11:36:10 -04:00
Eli Barzilay
8d0db4cd35 Lots of improvements:
* Rename `make-command-{reader,evaluator}' ->  `make-xrepl-{reader,evaluator}'

* Move the commented-out ,meta block to a better place

* Protect the prompt computation against errors, to avoid infinite
  exception output if an exception is raised.

* Add ",switch ?" to query namespaces, and ",switch - <name>" to remove
  one.  Forbid resetting the default initial `*' namespace.

* Clarify that multiple arguments can be sent to ,stx and fix it to
  display the current syntax when there are no arguments.

* Various minor typos and improvements.

* Restore the use-last-arguments-by-default functionality of ,rr

* Re-do argument reading to make it easier to have a default
  argument (as in ,enter and ,edit).
(cherry picked from commit c57ab7b4fc)
2011-07-19 11:36:07 -04:00
Eli Barzilay
71ea3183ba Rename prompt-shown' -> zero-column!', and use it only in the
non-readline reader.  Use line reading for ,install!.

(Cherry-picked from 3f8bb7a, and edited conflucts because
`port-set-next-location!' is not added to the release.)
2011-07-19 11:34:29 -04:00
Eli Barzilay
225f563bda Add a new #:dont-re-require-enter' flag for enter!', to avoid
requiring itself into the entered namespace.

This makes it useful in some cases where this require leads to a
dependency cycle, eg (enter! racket/list).  It's obviously not useful
for use as-is, since you will not have a bound `enter!' to get out of
the namespace (and possibly no `require' to get it) -- but it is useful
for meta-tools like xrepl.  This is why the flag is verbose.  `xrepl'
now uses this flag.

Also, the check for valid keywords for the form is now done at runtime
rather than in the macro.  This doesn't matter in this case, since the
form is intended for interactive use anyway.

Also, separate the two parts of `enter-load/use-compiled' (it was
defined curried, but didn't use it).
(cherry picked from commit db7f2b4542)
2011-07-18 12:42:42 -04:00
Eli Barzilay
0b0de351fd New `xrepl' collection.
(cherry picked from commit c544ebfe6c)
2011-07-14 17:29:53 -04:00