From 34e2f213374a2e5fa9ce16bb56e6605c7b71a61f Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 19 Jun 2000 04:58:15 +0000 Subject: [PATCH] Fix bug: empty folder wasn't noticing new messages being added. --- v7/src/imail/imail-top.scm | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm index 3e8b74520..c3bd4d4d8 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.169 2000/06/19 04:37:25 cph Exp $ +;;; $Id: imail-top.scm,v 1.170 2000/06/19 04:58:15 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -1345,12 +1345,16 @@ A prefix argument says to prompt for a URL and append all messages (let* ((folder (selected-folder)) (count (folder-modification-count folder))) (probe-folder folder) - (if (> (folder-modification-count folder) count) - (let ((unseen (navigator/first-unseen-message folder))) - (if unseen - (select-message folder unseen) - (message "No unseen messages"))) - (message "No changes to mail folder")))))) + (cond ((<= (folder-modification-count folder) count) + (message "No changes to mail folder")) + ((navigator/first-unseen-message folder) + => (lambda (unseen) (select-message folder unseen))) + ((selected-message #f) + (message "No unseen messages")) + ((navigator/first-message folder) + => (lambda (first) (select-message folder first))) + (else + (message "No changes to mail folder"))))))) (define-command imail-disconnect "Disconnect the selected IMAIL folder from its server. @@ -1736,12 +1740,7 @@ Negative argument means search in reverse." (directory-pathname (file-folder-pathname folder)) (user-homedir-pathname))) (add-event-receiver! (folder-modification-event folder) - (lambda (folder type parameters) - (if (eq? type 'EXPUNGE) - (maybe-add-command-suffix! notice-message-expunge - folder - (car parameters)) - (maybe-add-command-suffix! notice-folder-modifications folder)))) + notice-folder-event) (add-kill-buffer-hook buffer delete-associated-buffers) (add-kill-buffer-hook buffer stop-probe-folder-thread) (start-probe-folder-thread buffer)))) @@ -1798,6 +1797,16 @@ Negative argument means search in reverse." ;;;; Mode-line updates +(define (notice-folder-event folder type parameters) + (case type + ((EXPUNGE) + (maybe-add-command-suffix! notice-message-expunge folder + (car parameters))) + ((INCREASE-LENGTH SET-LENGTH) + (maybe-add-command-suffix! notice-message-expunge folder 0)) + (else + (maybe-add-command-suffix! notice-folder-modifications folder)))) + (define (notice-message-expunge folder index) (let ((buffer (imail-folder->buffer folder #f))) (if buffer -- 2.25.1