From: Chris Hanson Date: Fri, 4 Feb 2000 05:00:16 +0000 (+0000) Subject: Fix improper usage of MAYBE-REVERT-BUFFER. X-Git-Tag: 20090517-FFI~4264 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e27a4aa92c7e1ac2646dc281ef3f6c9ecb905448;p=mit-scheme.git Fix improper usage of MAYBE-REVERT-BUFFER. --- diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm index b64c1690e..9c77bdd51 100644 --- a/v7/src/imail/imail-top.scm +++ b/v7/src/imail/imail-top.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-top.scm,v 1.12 2000/02/04 04:52:55 cph Exp $ +;;; $Id: imail-top.scm,v 1.13 2000/02/04 05:00:16 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -120,12 +120,14 @@ May be called with an IMAIL folder URL as argument; (or (folder-get folder 'BUFFER #f) (error:bad-range-argument buffer 'IMAIL-FOLDER->BUFFER))) -(define (buffer->imail-folder buffer) - (or (buffer-get buffer 'IMAIL-FOLDER #f) - (error:bad-range-argument buffer 'BUFFER->IMAIL-FOLDER))) - -(define (selected-folder) - (buffer->imail-folder (selected-buffer))) +(define (selected-folder #!optional error? buffer) + (let ((buffer + (if (or (default-object? buffer) (not buffer)) + (selected-buffer) + buffer))) + (or (buffer-get buffer 'IMAIL-FOLDER #f) + (and (if (default-object? error?) #t error?) + (error:bad-range-argument buffer 'SELECTED-FOLDER))))) (define (imail-url->buffer-name url) (url-body url)) @@ -135,14 +137,7 @@ May be called with an IMAIL folder URL as argument; () (lambda () (let ((folder (selected-folder))) - (maybe-revert-folder folder - (lambda (folder) - (prompt-for-yes-or-no? - (string-append - "Persistent copy of folder has changed since last read. " - (if (folder-modified? folder) - "Discard your changes" - "Re-read folder"))))) + (tl-maybe-revert-folder folder) (let ((n-new (poll-folder folder))) (cond ((not n-new) (message "(This folder has no associated inbox.)")) @@ -156,6 +151,16 @@ May be called with an IMAIL folder URL as argument; (if (= n-new 1) "" "s") " read"))))))) +(define (tl-maybe-revert-folder folder) + (maybe-revert-folder folder + (lambda (folder) + (prompt-for-yes-or-no? + (string-append + "Persistent copy of folder has changed since last read. " + (if (folder-modified? folder) + "Discard your changes" + "Re-read folder")))))) + (define-variable imail-new-mail-hook "An event distributor that is invoked when IMAIL incorporates new mail." (make-event-distributor)) @@ -264,15 +269,14 @@ DEL Scroll to previous screen of this message. (define (imail-revert-buffer buffer dont-use-auto-save? dont-confirm?) dont-use-auto-save? - (let ((folder (buffer->imail-folder buffer)) + (let ((folder (selected-folder #f buffer)) (message (selected-message #f buffer))) (let ((index (and message (message-index message)))) - (maybe-revert-folder folder - (lambda (folder) - (or dont-confirm? + (if (or dont-confirm? (prompt-for-yes-or-no? (string-append "Revert buffer from folder " - (url->string (folder-url folder))))))) + (url->string (folder-url folder))))) + (tl-maybe-revert-folder folder)) (select-message folder (cond ((eq? folder (message-folder message)) message)