>>>>> "Patrick" == Patrick M Rutkowski <rutsk...@gmail.com> writes:
Patrick> On Wed, Oct 28, 2009 at 7:44 AM, Alex Goncharov Patrick> <alex-goncha...@comcast.net> wrote: >> ,--- You/Patrick (Wed, 28 Oct 2009 05:30:37 -0400) ----* >> | >> | Take the following program: >> | cmucl -eval '(defun foo () (progn (format t "Hello World~%") (foo))) (foo)' >> | >> | What would be the most straight forward way to get CTRL+C to quit back >> | to the shell, as opposed to dumping me into a debugger? >> >> Why would you want it? >> >> The non-easiness of leaving Lisp is intentional -- there is often too >> much state to lose, and Ctrl-C or -D may be typed by accident. >> >> Use '(quit)', on a CMUCL prompt or in your program. >> >> E.g. >> >> lisp -eval '(progn (format t "Hello World~%") (quit))' >> >> -- Alex -- alex-goncha...@comcast.net -- >> Patrick> Because 99.9% of the time when I hit CTRL+C during development it's Patrick> because I've seen my program doing something wrong, and already know Patrick> how to fix it. Having to type CTRL-C-LPAREN-Q-U-I-T-RPAREN-ENTER every Patrick> time is really annoying. Patrick> Because in UNIX terminal culture CTRL+C means "quit the program, right Patrick> now". CMUCL shouldn't take license to make exceptions to what shell Patrick> users expect. Patrick> I've never experienced a single development environment in wich I Patrick> couldn't quit out of my program-to-be with a keyboard shortcut, so the Patrick> way CMUCL works here makes me very uncomfortable. Patrick> Both CLISP and SBCL have options like "--no-debug" that make CTRL+C Patrick> behave as is intended for sane shell use. Patrick> I thought that all would have been obvious, unless you're not familiar Patrick> with with UNIX. I thought -batch would do this but it doesn't; you're still dropped to the debugger. Adding a -no-debug option is possible. But really, I think what Alex is saying is that your use of Lisp is atypical. Having a repl and a debugger available to you is a huge win. This combined with slime (or ilisp or whatever) is a huge productivity gain. Having Ctrl-C drop me to the debugger is very useful. I can examine the stack, look at variables, evaluate different things, and even redefine functions on the fly. And I can exit the debugger and try again, with the current state. That you using Ctrl-C seems to indicate something unexpected has happened and you want to stop it. Fixing it on the fly and continuing seems much better than exiting the program, fixing the code, and starting again as if this were some C code. That's not how Lisp is intended to be used. If you really want your script to exit, all I can think of right now is binding *debugger-hook* like so: cmulisp -eval "(setf *debugger-hook* #'(lambda (c v) (ext:quit)))" -eval <your stuff> This works for me. Ray