[Ecls-list] Exposing console interrupt conditions usefully.

Samium Gromoff _deepfire at feelingofgreen.ru
Wed Jun 4 17:15:03 UTC 2008


Good day, list.

The supplied patch exposes console interrupts (Ctrl-c's)
as a subclass of SERIOUS-CONDITION, facilitating their handling
in a controllable manner.


diff --git a/src/clos/conditions.lsp b/src/clos/conditions.lsp
--- a/src/clos/conditions.lsp
+++ b/src/clos/conditions.lsp
@@ -653,6 +653,13 @@ returns with NIL."
                        (simple-condition-format-arguments condition)
                        (format-error-control-string condition)
                        (format-error-offset condition)))))
+
+ (define-condition si::interactive-interrupt (serious-condition)
+  ()
+  (:report (lambda (condition stream)
+            (declare (ignore condition))
+            (format stream "~&~@<Console interrupt.~:@>"))))
+
 )))
 ); nehw-lave
 
diff --git a/src/lsp/top.lsp b/src/lsp/top.lsp
--- a/src/lsp/top.lsp
+++ b/src/lsp/top.lsp
@@ -375,7 +375,7 @@ under certain conditions; see file 'Copyright' for details.")
 (defun terminal-interrupt (correctablep)
   (let ((*break-enable* t))
     (if correctablep
-      (cerror "Continues execution." "Console interrupt.")
+      (cerror "Continues execution." 'interactive-interrupt)
       (error "Console interrupt -- cannot continue."))))
 
 (defun tpl (&key ((:commands *tpl-commands*) tpl-commands)


regards, Samium Gromoff




More information about the ecl-devel mailing list