Skip to content

Commit

Permalink
1.0.10.48: new function TRY-RESTART
Browse files Browse the repository at this point in the history
* Factor out all "find-restart and maybe invoke-restart" logic to one
  place.
  • Loading branch information
nikodemus committed Oct 18, 2007
1 parent e066009 commit 1964eac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/code/condition.lisp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -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"

0 comments on commit 1964eac

Please sign in to comment.