From: Russell McManus
Subject: restart question
Date: 
Message-ID: <87pstpz05n.fsf@cl-user.org>
Suppose I want to provide the user with an aditional restart when
permission to open a file is denied.  In particular, I want to attempt
to check out the file from version control if the user selects the
restart.

What is the right incantation for this?  None of my lisp books address
the topic, and the examples in the CLHS have been unenlightening so
far.

-russ

This is what CMUCL has to say in this instance:

File-error in function LISP::FD-OPEN:
   Error opening #P"/foo/0.1/src/QMSLib/com/some_brokerage_firm/fx/qmslib/foo", Permission denied.
   [Condition of type KERNEL:SIMPLE-FILE-ERROR]

Restarts:
  0: [CONTINUE] Try again.
  1: [ABORT] Abort handling SLIME request.
  2: [CONTINUE] Return NIL from load of "home:.cmucl-init".
  3: [ABORT] Skip remaining initializations.

Backtrace:
  0: (LISP::FD-OPEN #P"/foo/0.1/src/QMSLib/com/some_brokerage_firm/fx/qmslib/foo" :INPUT NIL NIL ...)
  1: (LISP::OPEN-FD-STREAM #P"/foo/0.1/src/QMSLib/com/some_brokerage_firm/fx/qmslib/foo" :DIRECTION :INPUT :ELEMENT$
  2: ("Top-Level Form")[:TOP-LEVEL]
  3: ("DEFSLIMEFUN INTERACTIVE-EVAL")

From: Christophe Rhodes
Subject: Re: restart question
Date: 
Message-ID: <sqwtnxm9v8.fsf@cam.ac.uk>
Russell McManus <···············@yahoo.com> writes:

> Suppose I want to provide the user with an aditional restart when
> permission to open a file is denied.  In particular, I want to attempt
> to check out the file from version control if the user selects the
> restart.
>
> What is the right incantation for this?  None of my lisp books address
> the topic, and the examples in the CLHS have been unenlightening so
> far.

Something like (untested):

(let (s)
  (unwind-protect
      (progn
        (loop (restart-case 
                  (progn
                    (setq s (open "/path/to/file")) 
                    (return nil))
                (try-version-control () (get-file-from-vc)))
        (do-something-with s))
    (when s (close s))))
     
You may want to use the test function to the restart to limit its
visibility only to certain types of errors.

Christophe
From: Edi Weitz
Subject: Re: restart question
Date: 
Message-ID: <uirzhruo0.fsf@agharta.de>
On Mon, 11 Jul 2005 14:07:48 -0400, Russell McManus <···············@yahoo.com> wrote:

> Suppose I want to provide the user with an aditional restart when
> permission to open a file is denied.  In particular, I want to
> attempt to check out the file from version control if the user
> selects the restart.
>
> What is the right incantation for this?  None of my lisp books
> address the topic, and the examples in the CLHS have been
> unenlightening so far.

Have you read Peter's chapter about conditions and restarts?

  <http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html>

Cheers,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")