From a8722f10d08fbb027d8837be39628122621d69f8 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Thu, 19 Jun 2008 22:20:12 +0000 Subject: [PATCH] Cosmetic change to WITH-OPEN-FILE so that the macro argument looks more like the actual call (var filespec &rest open-args) instead of (var &rest open-args). Fix up the macro documentation too since that didn't really match the arguments very well either. --- code/macros.lisp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/code/macros.lisp b/code/macros.lisp index 8a5fd8f97..57390ac8b 100644 --- a/code/macros.lisp +++ b/code/macros.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.111 2008/01/03 11:41:51 cshapiro Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.112 2008/06/19 22:20:12 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1543,20 +1543,19 @@ ;;;; With-XXX -(defmacro with-open-file ((var &rest open-args) &parse-body (forms decls)) - "Bindspec is of the form (Stream File-Name . Options). The file whose - name is File-Name is opened using the Options and bound to the variable - Stream. If the call to open is unsuccessful, the forms are not - evaluated. The Forms are executed, and when they - terminate, normally or otherwise, the file is closed." +(defmacro with-open-file ((var filespec &rest open-args) &parse-body (forms decls)) + "The file whose name is Filespec is opened using the Open-args and + bound to the variable Var. If the call to open is unsuccessful, the + forms are not evaluated. The Forms are executed, and when they + terminate, normally or otherwise, the file is closed." (let ((abortp (gensym))) - `(let ((,var (open ,@open-args)) + `(let ((,var (open ,filespec ,@open-args)) (,abortp t)) ,@decls (unwind-protect - (multiple-value-prog1 - (progn ,@forms) - (setq ,abortp nil)) + (multiple-value-prog1 + (progn ,@forms) + (setq ,abortp nil)) (when ,var (close ,var :abort ,abortp)))))) @@ -1571,7 +1570,7 @@ ,@decls (unwind-protect (multiple-value-prog1 - (progn ,@forms) + (progn ,@forms) (setq ,abortp nil)) (when ,var (close ,var :abort ,abortp)))))) -- GitLab