1.0.10.48: new function TRY-RESTART
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 18 Oct 2007 13:23:12 +0000 (13:23 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 18 Oct 2007 13:23:12 +0000 (13:23 +0000)
* Factor out all "find-restart and maybe invoke-restart" logic to one
  place.

src/code/condition.lisp
version.lisp-expr

index 44270bb..5b406e0 100644 (file)
@@ -1287,15 +1287,16 @@ the values returned by the form as a list. No associated restarts."))
    CONTROL-ERROR if none exists."
   (invoke-restart (find-restart-or-control-error 'muffle-warning condition)))
 
+(defun try-restart (name condition &rest arguments)
+  (let ((restart (find-restart name condition)))
+    (when restart
+      (apply #'invoke-restart restart arguments))))
+
 (macrolet ((define-nil-returning-restart (name args doc)
              #!-sb-doc (declare (ignore doc))
              `(defun ,name (,@args &optional condition)
                 #!+sb-doc ,doc
-                ;; FIXME: Perhaps this shared logic should be pulled out into
-                ;; FLET MAYBE-INVOKE-RESTART? See whether it shrinks code..
-                (let ((restart (find-restart ',name condition)))
-                  (when restart
-                    (invoke-restart restart ,@args))))))
+                (try-restart ',name condition ,@args))))
   (define-nil-returning-restart continue ()
     "Transfer control to a restart named CONTINUE, or return NIL if none exists.")
   (define-nil-returning-restart store-value (value)
index 06be281..aaf8ffa 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.10.47"
+"1.0.10.48"