McParen / croatoan

This repository has been migrated to Codeberg.
Other
147 stars 13 forks source link

Make binding of *DEBUGGER-HOOK* optional #14

Closed D4ryus closed 5 years ago

D4ryus commented 5 years ago

Swank will also use DEBUGGER-HOOK which prevents it from working with WITH-SCREEN. Add an argument (BIND-DEBUGGER-HOOK-P) to optionally bind DEBUGGER-HOOK. The default behaviour is unchanged and binds DEBUGGER-HOOK to a lambda which ends the screen before printing the condition.

McParen commented 5 years ago

I am not using slime myself for interacting with ncurses, so I have not really verified this. But if you do use slime, then it sound useful. Slightly modified to remove the binding when nil is passed, then merged into master. Thanks.

veddox commented 5 years ago

@D4ryus could you elaborate on what this change does? (I'm not familiar with debugger-hook...)

Specifically, does it allow running of an ncurses program within slime, and how does setting bind-debugger-hook-p to T change the standard behaviour of croatoan?

D4ryus commented 5 years ago

@veddox when a condition is signaled and not handled the debugger-hook will be called. If you are using slime/swank it will bind *DEBUGGER-HOOK* to some handler which opens the debugger in slime. If *DEBUGGER-HOOK* is NIL, you will enter the default debugger which prints out the condition and all available restarts and leaves you inside the REPL. The default behaviour is broken when ncurses uses the terminal tho, which is why McParen binds a hook which cleanly closes the screen before printing the condition.

As for running ncruses program with slime, this does work, the problem is that your slime repl and evaluation request run in a different thread. But calls into the ncurses library must be done from the thread that initialized ncurses, e.g. the main thread that started sbcl in a terminal.

To make requests from the slime-repl work i use a list where i put requests into, which are then evaluated from within the ncurses thread. I then use conditions and restarts so that i get errors inside the slime debugger.

@McParen if you are interested i could open a pull request (might take some time to polish it tho)

McParen commented 5 years ago

I am personally not that interested in using slime with ncurses at this point. If you think you can make it work for others, and in an optional way that does not mandate its use, I'd gladly include it.

@veddox

The easiest way to see the difference is to run test t06a with bind-debugger-hook-p enabled (default) and disabled.