Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Aborting automaticaly on errors in the repl

28 views
Skip to first unread message

Fernando Rodríguez

unread,
Sep 12, 2006, 4:29:23 AM9/12/06
to

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


Espen Vestre

unread,
Sep 12, 2006, 4:41:02 AM9/12/06
to
Fernando Rodríguez <f...@fernando-rodriguez.com> writes:

Type :a !
--
(espen)

Pascal Bourguignon

unread,
Sep 12, 2006, 8:28:04 AM9/12/06
to

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!"

sross

unread,
Sep 13, 2006, 5:57:10 AM9/13/06
to
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.

Fernando Rodríguez

unread,
Sep 14, 2006, 2:51:12 AM9/14/06
to
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! :-)


0 new messages