Change notifier to use only the GLOBAL-MODE-STRING editor variable.
authorChris Hanson <org/chris-hanson/cph>
Fri, 4 Mar 1994 21:30:40 +0000 (21:30 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 4 Mar 1994 21:30:40 +0000 (21:30 +0000)
v7/src/edwin/modlin.scm
v7/src/edwin/notify.scm

index 53c38b3a3192878feac9df5836cabc9b88ec2bee..6a512e4cd43305865f1b51e5d512c3b1e2721728 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: modlin.scm,v 1.16 1993/08/10 06:48:48 cph Exp $
+;;;    $Id: modlin.scm,v 1.17 1994/03/04 21:30:33 cph Exp $
 ;;;
-;;;    Copyright (c) 1989-93 Massachusetts Institute of Technology
+;;;    Copyright (c) 1989-94 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -77,7 +77,6 @@ Decimal digits after the % specify field width to which to pad."
        mode-line-buffer-identification
        "   "
        global-mode-string
-       notify-string
        "   %[(%M%m%n"
        mode-line-process
        ")%]----"
index da2e883b8a731ec7a254a40f1c799d7937fe05b2..51614079e2cebeefdce2d48855f8f70866d0626b 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: notify.scm,v 1.13 1993/11/17 22:23:14 cph Exp $
+;;;    $Id: notify.scm,v 1.14 1994/03/04 21:30:40 cph Exp $
 ;;;
-;;;    Copyright (c) 1992-93 Massachusetts Institute of Technology
+;;;    Copyright (c) 1992-94 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -141,19 +141,17 @@ Ignored if notify-show-mail is false."
        (cons (ref-variable-object notify-show-time) notifier:time)
        (cons (ref-variable-object notify-show-load) notifier:load-average)))
 
-(define (update-notify-string! string)
-  (set-variable! notify-string
-                (if (or (string-null? (ref-variable global-mode-string))
-                        (string-null? string))
-                    string
-                    (string-append " " string)))
-  (global-window-modeline-event!))
+(define (notifier:get-string window)
+  window
+  (string-append-separated notifier-element-string notifier-mail-string))
 
-(define-variable notify-string
-  "This is an internal variable.  Don't change it."
-  ""
-  string?)
+(define (update-notifier-strings! element mail)
+  (set! notifier-element-string element)
+  (set! notifier-mail-string mail)
+  (global-window-modeline-event!))
 
+(define notifier-element-string "")
+(define notifier-mail-string "")
 (define mail-notify-hook-installed? #f)
 (define current-notifier-thread #f)
 (define notifier-thread-registration #f)
@@ -170,13 +168,15 @@ which can show various things including time, load average, and mail status."
          (add-event-receiver!
           (ref-variable rmail-new-mail-hook)
           (lambda ()
-            (update-notify-string!
+            (update-notifier-strings!
+             notifier-element-string
              (if (ref-variable notify-show-mail)
                  (ref-variable notify-mail-not-present)
                  ""))))
          (set! mail-notify-hook-installed? #t)
          unspecific))
     ((ref-command kill-notifier))
+    (set-variable! global-mode-string `("" ,notifier:get-string))
     (let ((thread
           (create-thread
            editor-thread-root-continuation
@@ -193,16 +193,15 @@ which can show various things including time, load average, and mail status."
     unspecific))
 
 (define (notifier)
-  (set-variable! global-mode-string
-                (reduce string-append-separated
-                        ""
-                        (map (lambda (element)
-                               (if (and (car element)
-                                        (variable-value (car element)))
-                                   ((cdr element))
-                                   ""))
-                             notifier-elements)))
-  (update-notify-string!
+  (update-notifier-strings!
+   (reduce string-append-separated
+          ""
+          (map (lambda (element)
+                 (if (and (car element)
+                          (variable-value (car element)))
+                     ((cdr element))
+                     ""))
+               notifier-elements))
    (if (and mail-notify-hook-installed?
            (ref-variable notify-show-mail))
        (notifier:mail-present)
@@ -228,4 +227,4 @@ which can show various things including time, load average, and mail status."
             (set! notifier-thread-registration #f)))
        unspecific))
     (set-variable! global-mode-string "")
-    (update-notify-string! "")))
\ No newline at end of file
+    (update-notifier-strings! "" "")))
\ No newline at end of file