From: Chris Hanson Date: Mon, 22 May 2000 19:44:44 +0000 (+0000) Subject: Implement WITH-OPEN-FOLDER, which guarantees that the folder is opened X-Git-Tag: 20090517-FFI~3739 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fe42fbd7d2714fc71c27f3574b584e6fef1c1f60;p=mit-scheme.git Implement WITH-OPEN-FOLDER, which guarantees that the folder is opened and closed as necessary. --- 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