Update riece-addons when insinuate/uninstall.
[riece] / lisp / riece-unread.el
index 0697367..e35c0e3 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-unread.el --- "unread message mark" add-on
+;;; riece-unread.el --- mark channels where new messages arrived
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -23,7 +23,9 @@
 
 ;;; Commentary:
 
-;; This add-on marks channels where new messages are arrived.
+;; NOTE: This is an add-on module for Riece.
+
+;; This add-on marks channels where new messages arrived.
 
 ;; You can check the unread channels via `C-c g' in the commands
 ;; buffer, by adding the following lines to ~/.riece/init.el:
@@ -40,7 +42,7 @@
 (eval-when-compile (require 'riece-highlight))
 
 (defgroup riece-unread nil
-  "Mark unread channels"
+  "Mark unread channels."
   :tag "Unread"
   :prefix "riece-"
   :group 'riece)
   :group 'riece-highlight-faces)
 (defvar riece-channel-list-unread-face 'riece-channel-list-unread-face)
 
+(unless (riece-facep 'riece-modeline-unread-face)
+  (make-face 'riece-modeline-unread-face
+            "Face used for displaying unread channels in modeline.")
+  (if (featurep 'xemacs)
+      (set-face-parent 'riece-modeline-unread-face 'modeline))
+  (set-face-foreground 'riece-modeline-unread-face
+                      (face-foreground 'riece-channel-list-unread-face)))
+
 (defvar riece-unread-channels nil)
 
 (defvar riece-unread-enabled nil)
 
 (defconst riece-unread-description
-  "Mark channels where \"unread\" messages arrived")
+  "Mark channels where new messages arrived.")
 
 (defun riece-unread-after-display-message-function (message)
   (if riece-unread-enabled
@@ -80,8 +90,9 @@
 (defun riece-unread-after-switch-to-channel-function (last)
   (if riece-unread-enabled
       (setq riece-unread-channels
-           (delete riece-current-channel
-                   riece-unread-channels))))
+           (delq (car (riece-identity-member riece-current-channel
+                                             riece-unread-channels))
+                 riece-unread-channels))))
 
 (defun riece-unread-format-identity-for-channel-list-buffer (index identity)
   (if (and riece-unread-enabled
                string (replace-match "%%" nil nil string)))
        (list (format "%d:" index)
              (riece-propertize-modeline-string
-              string 'face 'riece-channel-list-unread-face)))))
+              string 'face 'riece-modeline-unread-face)))))
 
 (defun riece-unread-switch-to-channel ()
   (interactive)
     (error "No unread channel!")))
 
 (defun riece-guess-channel-from-unread ()
-  riece-unread-channels)
+  (reverse riece-unread-channels))
 
 (defun riece-unread-requires ()
   (let (requires)