* riece-unread.el
authorueno <ueno>
Sun, 7 Mar 2004 09:00:51 +0000 (09:00 +0000)
committerueno <ueno>
Sun, 7 Mar 2004 09:00:51 +0000 (09:00 +0000)
(riece-unread-format-identity-for-channel-list-indicator): New
function.
(riece-unread-insinuate): Setup
riece-format-identity-for-channel-list-indicator-functions.

* riece-history.el
(riece-history-format-identity-for-channel-list-buffer): New
function.
(riece-history-insinuate): Setup
riece-format-identity-for-channel-list-indicator-functions.

* riece-highlight.el
(riece-highlight-format-identity-for-channel-list-indicator): New
function.
(riece-highlight-insinuate): Setup
riece-format-identity-for-channel-list-indicator-functions.

* riece-display.el
(riece-format-identity-for-channel-list-buffer): Rename from
riece-format-channel-list-line.
(riece-format-identity-for-channel-list-indicator): New function.
(riece-update-channel-list-indicator): Use it.

lisp/ChangeLog
lisp/riece-display.el
lisp/riece-highlight.el
lisp/riece-history.el
lisp/riece-unread.el

index 2ab89e9..f433215 100644 (file)
@@ -1,5 +1,31 @@
 2004-03-07  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-unread.el
+       (riece-unread-format-identity-for-channel-list-indicator): New
+       function.
+       (riece-unread-insinuate): Setup
+       riece-format-identity-for-channel-list-indicator-functions.
+
+       * riece-history.el
+       (riece-history-format-identity-for-channel-list-buffer): New
+       function.
+       (riece-history-insinuate): Setup
+       riece-format-identity-for-channel-list-indicator-functions.
+
+       * riece-highlight.el
+       (riece-highlight-format-identity-for-channel-list-indicator): New
+       function.
+       (riece-highlight-insinuate): Setup
+       riece-format-identity-for-channel-list-indicator-functions.
+
+       * riece-display.el
+       (riece-format-identity-for-channel-list-buffer): Rename from
+       riece-format-channel-list-line.
+       (riece-format-identity-for-channel-list-indicator): New function.
+       (riece-update-channel-list-indicator): Use it.
+
+2004-03-07  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-handle.el (riece-parse-modes): Make sure that mode params
        are started at the beginning of the mode string.
        (riece-handle-channel-modes): Fixed arguments passed to
index b4f2ecf..f8a5e59 100644 (file)
@@ -237,6 +237,15 @@ Local to the buffer in `riece-buffer-list'.")
                    "\n")
            (setq users (cdr users)))))))
 
+(defun riece-format-identity-for-channel-list-buffer (index identity)
+  (or (run-hook-with-args-until-success
+       'riece-format-identity-for-channel-list-buffer-functions index identity)
+      (concat (format "%2d:%c" index
+                     (if (riece-identity-equal identity riece-current-channel)
+                         ?*
+                       ? ))
+             (riece-format-identity identity))))
+
 (defun riece-update-channel-list-buffer ()
   (save-excursion
     (let ((inhibit-read-only t)
@@ -247,20 +256,12 @@ Local to the buffer in `riece-buffer-list'.")
       (riece-kill-all-overlays)
       (while channels
        (if (car channels)
-           (insert (riece-format-channel-list-line index (car channels))
+           (insert (riece-format-identity-for-channel-list-buffer
+                    index (car channels))
                    "\n"))
        (setq index (1+ index)
              channels (cdr channels))))))
 
-(defun riece-format-channel-list-line (index channel)
-  (or (run-hook-with-args-until-success
-       'riece-format-channel-list-line-functions index channel)
-      (concat (format "%2d:%c" index
-                     (if (riece-identity-equal channel riece-current-channel)
-                         ?*
-                       ? ))
-             (riece-format-identity channel))))
-
 (defun riece-update-channel-indicator ()
   (setq riece-channel-indicator
        (if riece-current-channel
@@ -279,6 +280,12 @@ Local to the buffer in `riece-buffer-list'.")
              (riece-format-identity riece-current-channel))
          "None")))
 
+(defun riece-format-identity-for-channel-list-indicator (index identity)
+  (or (run-hook-with-args-until-success
+       'riece-format-identity-for-channel-list-indicator-functions
+       index identity)
+      (format "%d:%s" index (riece-format-identity identity))))
+
 (defun riece-update-channel-list-indicator ()
   (if (and riece-current-channels
           ;; There is at least one channel.
@@ -287,14 +294,16 @@ Local to the buffer in `riece-buffer-list'.")
        (setq riece-channel-list-indicator
              (mapconcat
               #'identity
-              (delq nil
-                    (mapcar
-                     (lambda (channel)
-                       (prog1
-                           (if channel
-                               (riece-format-channel-list-line index channel))
-                         (setq index (1+ index))))
-                     riece-current-channels))
+              (delq
+               nil
+               (mapcar
+                (lambda (channel)
+                  (prog1
+                      (if channel
+                          (riece-format-identity-for-channel-list-indicator
+                           index channel))
+                    (setq index (1+ index))))
+                riece-current-channels))
               ",")))
     (setq riece-channel-list-indicator "No channel")))
 
index 8eefc61..09d8b72 100644 (file)
   (setq font-lock-mode-hook nil)
   (turn-on-font-lock))
 
+(defun riece-highlight-format-identity-for-channel-list-indicator (index
+                                                                  identity)
+  (if (riece-identity-equal identity riece-current-channel)
+      (let ((string (riece-format-identity identity)))
+       (put-text-property 0 (length string)
+                          'face 'riece-channel-list-current-face
+                          string)
+       (concat (format "%d:" index) string))))
+
 (defun riece-highlight-insinuate ()
   (put 'riece-channel-mode 'font-lock-defaults
        '(riece-dialogue-font-lock-keywords t))
   (put 'riece-channel-list-mode 'font-lock-defaults
        '(riece-channel-list-font-lock-keywords t))
   (add-hook 'riece-after-load-startup-hook
-           'riece-channel-list-schedule-turn-on-font-lock))
+           'riece-channel-list-schedule-turn-on-font-lock)
+  (add-hook 'riece-format-identity-for-channel-list-indicator-functions
+           'riece-highlight-format-identity-for-channel-list-indicator))
 
 (provide 'riece-highlight)
 
index 4398410..a47833e 100644 (file)
            index (1+ index)))
     (nreverse result)))
 
-(defun riece-history-format-channel-list-line (index channel)
+(defun riece-history-format-identity-for-channel-list-buffer (index identity)
   (if (and (not (ring-empty-p riece-channel-history))
-          (riece-identity-equal channel (ring-ref riece-channel-history 0)))
+          (riece-identity-equal identity (ring-ref riece-channel-history 0)))
       (concat (format "%2d:+" index)
-             (riece-format-identity channel))))
+             (riece-format-identity identity))))
+
+(defun riece-history-format-identity-for-channel-list-indicator (index
+                                                                identity)
+  (if (and (not (ring-empty-p riece-channel-history))
+          (riece-identity-equal identity (ring-ref riece-channel-history 0)))
+      (let ((string (riece-format-identity identity)))
+       (put-text-property 0 (length string)
+                          'face 'riece-channel-list-history-face
+                          string)
+       (concat (format "%d:" index) string))))
 
 ;;; (defun riece-history-requires ()
 ;;;   (if (memq 'riece-guess riece-addons)
              (if (and last
                       (not (riece-identity-equal last riece-current-channel)))
                  (ring-insert riece-channel-history last))))
-  (add-hook 'riece-format-channel-list-line-functions
-           'riece-history-format-channel-list-line)
+  (add-hook 'riece-format-identity-for-channel-list-buffer-functions
+           'riece-history-format-identity-for-channel-list-buffer)
+  (add-hook 'riece-format-identity-for-channel-list-indicator-functions
+           'riece-history-format-identity-for-channel-list-indicator)
   (if (memq 'riece-highlight riece-addons)
       (setq riece-channel-list-mark-face-alist
            (cons '(?+ . riece-channel-list-history-face)
index 764bb63..d453727 100644 (file)
        (delete riece-current-channel
                riece-unread-channels)))
 
-(defun riece-unread-format-channel-list-line (index channel)
-  (if (riece-identity-member channel riece-unread-channels)
+(defun riece-unread-format-identity-for-channel-list-buffer (index identity)
+  (if (riece-identity-member identity riece-unread-channels)
       (concat (format "%2d:!" index)
-             (riece-format-identity channel))))
+             (riece-format-identity identity))))
+
+(defun riece-unread-format-identity-for-channel-list-indicator (index identity)
+  (if (riece-identity-member identity riece-unread-channels)
+      (let ((string (riece-format-identity identity)))
+       (put-text-property 0 (length string)
+                          'face 'riece-channel-list-unread-face
+                          string)
+       (concat (format "%d:" index) string))))
 
 (defun riece-unread-switch-to-channel ()
   (interactive)
            'riece-unread-after-display-message-function)
   (add-hook 'riece-after-switch-to-channel-functions
            'riece-unread-after-switch-to-channel-function)
-  (add-hook 'riece-format-channel-list-line-functions
-           'riece-unread-format-channel-list-line)
+  (add-hook 'riece-format-identity-for-channel-list-buffer-functions
+           'riece-unread-format-identity-for-channel-list-buffer)
+  (add-hook 'riece-format-identity-for-channel-list-indicator-functions
+           'riece-unread-format-identity-for-channel-list-indicator)
   (define-key riece-command-mode-map
     "\C-c\C-u" 'riece-unread-switch-to-channel)
   (define-key riece-dialogue-mode-map