I picked "#<image>" not because I think it is a good way to print,
but just so that there is something there to be easily changed later,
when someone who has an opinion decides to change it.
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.
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".)
* 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).