From 7e251077799ef0bca255fec203ee208ffc1802ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Wed, 29 May 2024 08:23:50 +0200 Subject: [PATCH] repl: always call clear-input when SERIOUS-CONDITION is encountered Consider the following input from string: #j :r1 First the reader signals a condition that there is no dispatch character macro for #j, and then we select the first restart. That's clearly undesireable. --- src/lsp/top.lsp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lsp/top.lsp b/src/lsp/top.lsp index 045339b48..e746724b0 100644 --- a/src/lsp/top.lsp +++ b/src/lsp/top.lsp @@ -572,15 +572,16 @@ Use special code 0 to cancel this operation.") (set-break-env) (set-current-ihs) (flet ((rep () - ;; We let warnings pass by this way "warn" does the - ;; work. It is conventional not to trap anything - ;; that is not a SERIOUS-CONDITION. Otherwise we - ;; would be interferring the behavior of code that relies - ;; on conditions for communication (for instance our compiler) - ;; and which expect nothing to happen by default. + ;; We let warnings pass by this way "warn" does the work. It is + ;; conventional not to trap anything that is not a + ;; SERIOUS-CONDITION. Otherwise we would be interferring the + ;; behavior of code that relies on conditions for communication + ;; (for instance our compiler) and which expect nothing to happen + ;; by default. (handler-bind ((serious-condition (lambda (condition) + (clear-input *query-io*) (cond ;; Toplevel should enter the debugger on any condition. ((< break-level 1)) @@ -591,7 +592,6 @@ Use special code 0 to cancel this operation.") (tpl-format "~&Debugger received error of type: ~A~%~A~%" (type-of condition) condition) (tpl-format "Error flushed.~%") - (clear-input *query-io*) (return-from rep t)))))) (with-grabbed-console (unless quiet