Hi,
Is there a way to make lispworks automaticaly abort on all errors in the
repl? Most of the time, the errors are simple typos, and having to go through
the list of options every time to find the abort option (and it's not even
always the same!) is a pain in the behind...
Thanks in advance
Fernando Rodr�guez <···@fernando-rodriguez.com> writes:
> Hi,
>
> Is there a way to make lispworks automaticaly abort on all errors in
> the repl? Most of the time, the errors are simple typos, and having to
> go through the list of options every time to find the abort option
> (and it's not even always the same!) is a pain in the behind...
>
> Thanks in advance
Type :a !
--
(espen)
Fernando Rodr�guez <···@fernando-rodriguez.com> writes:
> Is there a way to make lispworks automaticaly abort on all errors in
> the repl? Most of the time, the errors are simple typos, and having to
> go through the list of options every time to find the abort option
> (and it's not even always the same!) is a pain in the behind...
You can write your own REPL.
For example:
(defmacro handling-errors (&body body)
`(HANDLER-CASE (progn ,@body)
(simple-condition
(ERR)
(format *error-output* "~&~A: ~%" (class-name (class-of err)))
(apply (function format) *error-output*
(simple-condition-format-control err)
(simple-condition-format-arguments err))
(format *error-output* "~&")
(finish-output))
(condition
(ERR)
(format *error-output* "~&~A: ~% ~S~%"
(class-name (class-of err)) err)
(finish-output)))))
(defun repl ()
(do ((+eof+ (gensym))
(hist 1 (1+ hist)))
(nil)
(format t "~%~A[~D]> " (package-name *package*) hist)
(finish-output)
(handling-errors
(setf - (read *standard-input* nil +eof+))
(when (or (eq - +eof+)
(member - '((quit)(exit)(continue)) :test (function equal)))
(return-from repl))
(let ((results (multiple-value-list (eval -))))
(shiftf +++ ++ + -)
(shiftf /// // / results)
(shiftf *** ** * (first /)))
(format t "~& --> ~{~S~^ ;~% ~}~%" /)
(finish-output))))
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Indentation! -- I will show you how to indent when I indent your skull!"
Fernando Rodríguez wrote:
> Hi,
>
> Is there a way to make lispworks automaticaly abort on all errors in the
> repl?
you could provide a value for *debugger-hook* .
(defun my-debugger-hook (c hook)
(declare (ignore hook))
(when (find-restart 'abort c)
(princ c)
(abort c)))
(setf *debugger-hook* 'my-debugger-hook)
sean.
Hello sross,
>> Is there a way to make lispworks automaticaly abort on all errors in
>> the repl?
>>
> you could provide a value for *debugger-hook* .
>
> (defun my-debugger-hook (c hook)
> (declare (ignore hook))
> (when (find-restart 'abort c)
> (princ c)
> (abort c)))
> (setf *debugger-hook* 'my-debugger-hook)
Much better now. Thanks! :-)