gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] proposed find-restart bugfix


From: Peter Wood
Subject: [Gcl-devel] proposed find-restart bugfix
Date: Sun, 20 Oct 2002 11:59:28 +0200
User-agent: Mutt/1.4i

Hi

On the Savannah bug page for GCL, (Task #1521)

http://savannah.gnu.org/pm/task.php?func=detailtask&project_task_id=1521&group_id=879&group_project_id=375

"Summary:  (ANSI) COMPUTE-RESTARTS should take an optional parameter"

I believe there was a typo here, since #'compute-restarts _does_ take
an optional parameter (a condition).  Perhaps the report should have
refered to #'find-restarts which should (but doesn't in current GCL).

Anyway, here is a lightly tested proposed bugfix:

(in-package "CONDITIONS")

(defun find-restart (name &optional condition)
  (if condition
      (let ((restarts (compute-restarts condition)))
        (dolist (restart restarts)
          (when (or (eq restart name)
                    (eq (restart-name restart) name))
            (return-from find-restart restart))))
    (let ((restarts (kcl-top-restarts)))
      (dolist (restart restarts)
        (when (or (eq restart name)
                  (eq (restart-name restart) name))
          (return-from find-restart restart))))))

(in-package "COMMON-LISP-USER")

Example usage:

>(find-restart 'abort)

#<RESTART.0>

>(find-restart 'abort (make-condition 'error))

#<RESTART.0>

>(find-restart 'foo )

NIL

>(find-restart 'foo (make-condition 'error))

NIL

May I check in this bugfix?

Regards,
Peter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]