From fe42fbd7d2714fc71c27f3574b584e6fef1c1f60 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 22 May 2000 19:44:44 +0000 Subject: [PATCH] Implement WITH-OPEN-FOLDER, which guarantees that the folder is opened and closed as necessary. --- v7/src/imail/imail-core.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/v7/src/imail/imail-core.scm b/v7/src/imail/imail-core.scm index 8f67c4880..c725bb219 100644 --- a/v7/src/imail/imail-core.scm +++ b/v7/src/imail/imail-core.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-core.scm,v 1.83 2000/05/22 15:07:55 cph Exp $ +;;; $Id: imail-core.scm,v 1.84 2000/05/22 19:44:44 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -297,6 +297,15 @@ (define-generic %open-folder (url)) +(define (with-open-folder url thunk) + (let ((folder (get-memoized-folder url))) + (if folder + (thunk) + (let ((folder (%open-folder url))) + (let ((v (thunk))) + (close-folder folder) + v))))) + ;; ------------------------------------------------------------------- ;; Close FOLDER, freeing up connections, memory, etc. Subsequent use ;; of the folder must work, but may incur a significant time or space -- 2.25.1