From: Chris Hanson Date: Mon, 22 May 2000 22:41:00 +0000 (+0000) Subject: Fix bug: don't mistakenly say that a folder is unchanged by reading X-Git-Tag: 20090517-FFI~3729 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=ff914a1407ca4ae93a73c77455562feafee78f9f;p=mit-scheme.git Fix bug: don't mistakenly say that a folder is unchanged by reading the modification count at the wrong time. --- diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm index e69fbd431..bd14be822 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.88 2000/05/22 20:57:22 cph Exp $ +;;; $Id: imail-top.scm,v 1.89 2000/05/22 22:41:00 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -1144,26 +1144,31 @@ Selects the first new message if any new mail. Currently useful only for IMAP folders." () (lambda () - (let ((folder (selected-folder))) - (let ((count (folder-modification-count folder)) - (last (navigator/last-message folder))) - (probe-folder folder) - (if (> (folder-modification-count folder) count) - (select-message - folder - (or (cond ((not last) - (navigator/first-message folder)) - ((message-attached? last folder) - (navigator/next-message last)) - ((message-index last) - => (lambda (index) - (let ((index (+ index 1))) - (if (< index (folder-length folder)) - (get-message folder index) - (navigator/first-unseen-message folder))))) - (else (navigator/first-unseen-message folder))) - (selected-message #f))) - (message "(No changes to mail folder)")))))) + (let* ((folder (selected-folder)) + (count (folder-modification-count folder)) + ;; NAVIGATOR/LAST-MESSAGE must run _after_ + ;; FOLDER-MODIFICATION-COUNT as it can potentially change + ;; its value. (E.g. when IMAP folder is closed, this + ;; reopens it, reads new information from the server, and + ;; changes the modification count.) + (last (navigator/last-message folder))) + (probe-folder folder) + (if (> (folder-modification-count folder) count) + (select-message + folder + (or (cond ((not last) + (navigator/first-message folder)) + ((message-attached? last folder) + (navigator/next-message last)) + ((message-index last) + => (lambda (index) + (let ((index (+ index 1))) + (if (< index (folder-length folder)) + (get-message folder index) + (navigator/first-unseen-message folder))))) + (else (navigator/first-unseen-message folder))) + (selected-message #f))) + (message "(No changes to mail folder)"))))) (define-command imail-save-folder "Save the currently selected IMAIL folder."