Discussion:
any lisper out there?
Frederic Udina
2002-05-30 14:43:03 UTC
Permalink
Hi silent lispers,

I have a problem and seek for a solution.

Within of a lisp program,
I want to copy a file from the current directory to a system directory.
It could be the case (it is often) that the system directory is
write-protected and so (rename-file old new) gives an error.

How can I prevent the error? Is the function ERRSET working? Does it
anything useful?

ERRSET
[function-doc]
Args: (expr [pflag])
Traps errors occurring during the evaluation of EXPR. PFLAG controls
printing
of the error message. Returns the value of the last expression consed with
NIL or NIL.

Any clue?


Frederic Udina
____________________________________________________________________
<***@upf.es> Dept. D'Economia i Empresa Universitat Pompeu Fabra
Ramon Trias Fargas, 25-27 08005 Barcelona SPAIN
tel. 34- 935421756/1763 fax: 34- 935421746 http://libiya.upf.es/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are many here among us who feel that life is but a joke B.Dy.
Luke Tierney
2002-05-30 15:14:37 UTC
Permalink
ERRSET is a non-standard, low level procedure. It's better to use the
condition system. Either
(ignore-errors (rename-file "foo" "bar"))
NIL
#<Condition SIMPLE-ERROR: 817abb0>


or
(handler-case (rename-file "foo" "bar")
(error (e) e))
#<Condition SIMPLE-ERROR: 81d6f30>
(princ *)
can't rename file - "foo"
#<Condition SIMPLE-ERROR: 81d6f30>

luke
Hi silent lispers,
I have a problem and seek for a solution.
Within of a lisp program,
I want to copy a file from the current directory to a system directory.
It could be the case (it is often) that the system directory is
write-protected and so (rename-file old new) gives an error.
How can I prevent the error? Is the function ERRSET working? Does it
anything useful?
ERRSET
[function-doc]
Args: (expr [pflag])
Traps errors occurring during the evaluation of EXPR. PFLAG controls
printing
of the error message. Returns the value of the last expression consed with
NIL or NIL.
Any clue?
Frederic Udina
____________________________________________________________________
Ramon Trias Fargas, 25-27 08005 Barcelona SPAIN
tel. 34- 935421756/1763 fax: 34- 935421746 http://libiya.upf.es/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are many here among us who feel that life is but a joke B.Dy.
--
Luke Tierney
University of Minnesota Phone: 612-625-7843
School of Statistics Fax: 612-624-8868
313 Ford Hall, 224 Church St. S.E. email: ***@stat.umn.edu
Minneapolis, MN 55455 USA WWW: http://www.stat.umn.edu
Forrest Young
2002-05-30 15:42:45 UTC
Permalink
you can use ignore-errors
Post by Frederic Udina
Hi silent lispers,
I have a problem and seek for a solution.
Within of a lisp program,
I want to copy a file from the current directory to a system directory.
It could be the case (it is often) that the system directory is
write-protected and so (rename-file old new) gives an error.
How can I prevent the error? Is the function ERRSET working? Does it
anything useful?
ERRSET
[function-doc]
Args: (expr [pflag])
Traps errors occurring during the evaluation of EXPR. PFLAG controls
printing
of the error message. Returns the value of the last expression consed with
NIL or NIL.
Any clue?
Frederic Udina
____________________________________________________________________
Ramon Trias Fargas, 25-27 08005 Barcelona SPAIN
tel. 34- 935421756/1763 fax: 34- 935421746 http://libiya.upf.es/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are many here among us who feel that life is but a joke B.Dy.
Loading...