From: Chris Hanson Date: Mon, 5 Jun 2000 18:16:44 +0000 (+0000) Subject: Fix bug: When message was selected in IMAIL and deleted by a different X-Git-Tag: 20090517-FFI~3607 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=96ca689ad68aa8b87b23b9f25f9cd96cbb059bf9;p=mit-scheme.git Fix bug: When message was selected in IMAIL and deleted by a different user agent, IMAIL would end up in state where there is no selected message. Now, it selects another message. --- diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm index e1dae82bf..ff7a01326 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.127 2000/06/05 17:50:10 cph Exp $ +;;; $Id: imail-top.scm,v 1.128 2000/06/05 18:16:44 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -838,8 +838,11 @@ With prefix argument N moves backward N messages with these flags." (user-homedir-pathname))) (add-event-receiver! (folder-modification-event folder) (lambda (folder type parameters) - type parameters - (maybe-add-command-suffix! notice-folder-modifications folder))) + (if (eq? type 'EXPUNGE) + (maybe-add-command-suffix! notice-message-expunge + folder + (car parameters)) + (maybe-add-command-suffix! notice-folder-modifications folder)))) (add-kill-buffer-hook buffer delete-associated-buffers) (add-kill-buffer-hook buffer stop-probe-folder-thread) (start-probe-folder-thread buffer)))) @@ -899,6 +902,20 @@ With prefix argument N moves backward N messages with these flags." buffer) (buffer-modeline-event! buffer 'PROCESS-STATUS))))) +(define (notice-message-expunge folder index) + (let ((buffer (imail-folder->buffer folder #f))) + (if buffer + (let ((m (selected-message #f buffer))) + (if (or (not m) + (message-detached? m)) + (select-message folder + (let ((length (folder-length folder))) + (cond ((< index length) index) + ((> length 0) (- length 1)) + (else #f))) + #t))))) + (notice-folder-modifications folder)) + (define (imail-mode-line-summary-string buffer) (let ((folder (selected-folder #f buffer)) (message (selected-message #f buffer))) @@ -1311,16 +1328,15 @@ With prefix argument N, undeletes backward N messages, (imail-expunge-pop-up-messages folder) (do-prompt))) (do-prompt)))))) - (let ((message - (let ((message (selected-message))) - (if (message-deleted? message) - (or (next-message message message-undeleted?) - (previous-message message message-undeleted?) - (next-message message) - (previous-message message)) - message)))) - (expunge-deleted-messages folder) - (select-message folder message))) + (let ((message (selected-message))) + (if (message-deleted? message) + (select-message + folder + (or (next-message message message-undeleted?) + (previous-message message message-undeleted?) + (next-message message) + (previous-message message))))) + (expunge-deleted-messages folder)) (else (message "Messages not expunged"))))))) diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index 36320fb72..94bfba730 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,13 +1,9 @@ IMAIL To-Do List -$Id: todo.txt,v 1.60 2000/06/05 17:34:57 cph Exp $ +$Id: todo.txt,v 1.61 2000/06/05 18:16:34 cph Exp $ Bug fixes --------- -* When message is selected in IMAIL and deleted by a different user - agent, IMAIL ends up in state that there is no selected message. - Instead, it should select another message. - * M-x imail-copy-messages re-reads the target folder UIDs for each message that is written, when the target folder is not being visited. [I haven't seen this lately. Maybe it's fixed?]