From: Chris Hanson Date: Mon, 26 Jun 2000 19:31:07 +0000 (+0000) Subject: Show message in modeline of all buffers when there is unseen mail. X-Git-Tag: 20090517-FFI~3442 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d560960a3afd51f90f8e1ae478f9c36bc26125cf;p=mit-scheme.git Show message in modeline of all buffers when there is unseen mail. Variable imail-global-mail-notification controls this feature. --- diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm index 75798430a..a9a347883 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.192 2000/06/26 19:08:18 cph Exp $ +;;; $Id: imail-top.scm,v 1.193 2000/06/26 19:30:33 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -183,10 +183,17 @@ Either #F or a pathname." (define-variable imail-mime-show-alternatives "If true, all parts of a multipart/alternative message are shown. -\(Only one of the parts will be shown in line; the others as attachments.) + (Only one of the parts will be shown in-line; the others as attachments.) Otherwise, only one of the parts is shown." #f boolean?) + +(define-variable imail-global-mail-notification + "If true, all buffer modelines say if there is unseen mail. + (This checks only for unseen mail in the primary folder.) +Otherwise, only the IMAIL buffer for that folder has an indicator." + #t + boolean?) (define-command imail "Read and edit incoming mail. @@ -1819,6 +1826,14 @@ Negative argument means search in reverse." (local-set-variable! mode-line-process (imail-mode-line-summary-string buffer) buffer) + (if (and (ref-variable imail-global-mail-notification buffer) + (eq? (folder-url folder) (imail-default-url))) + (begin + (set-variable! global-mode-string + (if (> (count-unseen-messages folder) 0) + "[New Mail]" + "")) + (global-window-modeline-event!))) (buffer-modeline-event! buffer 'PROCESS-STATUS))))) (define (imail-mode-line-summary-string buffer) @@ -1838,15 +1853,10 @@ Negative argument means search in reverse." (else "0"))) "/" (number->string n) - (let loop ((i 0) (unseen 0)) - (cond ((< i n) - (loop (+ i 1) - (if (message-unseen? (get-message folder i)) - (+ unseen 1) - unseen))) - ((> unseen 0) - (string-append " (" (number->string unseen) " unseen)")) - (else ""))) + (let ((unseen (count-unseen-messages folder))) + (if (> unseen 0) + (string-append " (" (number->string unseen) " unseen)") + "")) (let ((flags (if message (flags-delete "seen" (message-flags message)) @@ -1854,6 +1864,15 @@ Negative argument means search in reverse." (if (pair? flags) (string-append " " (decorated-string-append "" "," "" flags)) ""))))))) + +(define (count-unseen-messages folder) + (let ((n (folder-length folder))) + (do ((i 0 (+ i 1)) + (unseen 0 + (if (message-unseen? (get-message folder i)) + (+ unseen 1) + unseen))) + ((= i n) unseen)))) ;;;; Probe-folder thread diff --git a/v7/src/imail/imail.pkg b/v7/src/imail/imail.pkg index 6e00f8545..79c9ff635 100644 --- a/v7/src/imail/imail.pkg +++ b/v7/src/imail/imail.pkg @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail.pkg,v 1.67 2000/06/26 19:02:38 cph Exp $ +;;; $Id: imail.pkg,v 1.68 2000/06/26 19:30:57 cph Exp $ ;;; ;;; Copyright (c) 2000 Massachusetts Institute of Technology ;;; @@ -262,6 +262,7 @@ edwin-variable$imail-expunge-confirmation edwin-variable$imail-forward-all-headers edwin-variable$imail-forward-using-mime + edwin-variable$imail-global-mail-notification edwin-variable$imail-ignored-headers edwin-variable$imail-inline-mime-text-subtypes edwin-variable$imail-kept-headers diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index 042c15e02..4e8f3d2c0 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,5 +1,5 @@ IMAIL To-Do List -$Id: todo.txt,v 1.98 2000/06/26 19:02:39 cph Exp $ +$Id: todo.txt,v 1.99 2000/06/26 19:31:07 cph Exp $ Bug fixes --------- @@ -45,9 +45,6 @@ New features folder is locally modified. Meaningful only for file folders. Hook up the save-folder code into M-x save-some-buffers. -* Add mail notification in mode line, active across the editor as long - as there is an IMAP connection open in some buffer. - * Implement cache that saves information about messages on disk. This should use UIDs for IMAP folders; for other folders perhaps the message ID can be used. (Or perhaps no cache is required for