garethw wrote:Is it possible to establish a condition handler at the REPL in such a way that it can handle conditions that occur at the REPL?
Only if the condition handler is established
before the REPL is started. For example, some Common Lisp implementations provide command-line arguments or implementation-specific hooks for customizing the Common Lisp REPL.
AFAIK the only semi-portable way to customize the error handling from the REPL is making the Common Lisp
*DEBUGGER-HOOK* point to a function that is run before the implementation-specific debugger is entered. This way the Slime debugger is hooked into Common Lisp. But to replace
UNDEFINED-FUNCTION conditions with your own function via the
*DEBUGGER-HOOK* without entering the implementation-specific debugger afterwards, your Common Lisp implementation needs to provide a
USE-VALUE restart for the
UNDEFINED-FUNCTION condition, what not all implementations do.
I'm writing "semi-portable" because the debugger behaviour is entirely implementation-defined. To support multiple implementations you probably would need to write and maintain #+ and #- implementation-specific code.
AFAIK the only other alternative is to write your own REPL enclosed with appropriate condition handlers and run it inside the Common Lisp REPL.
- edgar