* riece-unread.el
authorueno <ueno>
Sun, 7 Mar 2004 09:59:46 +0000 (09:59 +0000)
committerueno <ueno>
Sun, 7 Mar 2004 09:59:46 +0000 (09:59 +0000)
(riece-unread-format-identity-for-channel-list-indicator): Escape
% -> %%; use riece-propertize-modeline-string.

* riece-history.el
(riece-history-format-identity-for-channel-list-indicator): Escape
% -> %%; use riece-propertize-modeline-string.

* riece-highlight.el
(riece-highlight-format-identity-for-channel-list-indicator):
Escape % -> %%; use riece-propertize-modeline-string.

* riece-display.el
(riece-format-identity-for-channel-list-indicator): Escape % ->
%%.
(riece-update-channel-list-indicator): Rewrite.

* riece-emacs.el (riece-propertize-modeline-string): New function.
* riece-xemacs.el (riece-propertize-modeline-string): New function.

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

index f433215..e37f53e 100644 (file)
@@ -1,6 +1,28 @@
 2004-03-07  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-unread.el
+       (riece-unread-format-identity-for-channel-list-indicator): Escape
+       % -> %%; use riece-propertize-modeline-string.
+
+       * riece-history.el
+       (riece-history-format-identity-for-channel-list-indicator): Escape
+       % -> %%; use riece-propertize-modeline-string.
+
+       * riece-highlight.el
+       (riece-highlight-format-identity-for-channel-list-indicator):
+       Escape % -> %%; use riece-propertize-modeline-string.
+
+       * riece-display.el
+       (riece-format-identity-for-channel-list-indicator): Escape % ->
+       %%.
+       (riece-update-channel-list-indicator): Rewrite.
+
+       * riece-emacs.el (riece-propertize-modeline-string): New function.
+       * riece-xemacs.el (riece-propertize-modeline-string): New function.
+
+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
index f8a5e59..19e6c8a 100644 (file)
@@ -284,27 +284,36 @@ Local to the buffer in `riece-buffer-list'.")
   (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))))
+      (let ((string (riece-format-identity identity))
+           (start 0))
+       ;; Escape % -> %%.
+       (while (string-match "%" string start)
+         (setq start (1+ (match-end 0))
+               string (replace-match "%%" nil nil string)))
+       (format "%d:%s" index string))))
 
 (defun riece-update-channel-list-indicator ()
   (if (and riece-current-channels
           ;; There is at least one channel.
           (delq nil (copy-sequence riece-current-channels)))
-      (let ((index 1))
+      (let ((index 1)
+           pointer)
        (setq riece-channel-list-indicator
-             (mapconcat
-              #'identity
-              (delq
-               nil
-               (mapcar
-                (lambda (channel)
-                  (prog1
-                      (if channel
-                          (riece-format-identity-for-channel-list-indicator
-                           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))
+             pointer riece-channel-list-indicator)
+       (while pointer
+         (if (cdr pointer)
+             (setcdr pointer (cons "," (cdr pointer))))
+         (setq pointer (cdr (cdr pointer)))))
     (setq riece-channel-list-indicator "No channel")))
 
 (defun riece-update-status-indicators ()
index 0e49815..ea6be0a 100644 (file)
 
 (defalias 'riece-match-string-no-properties 'match-string-no-properties)
 
+(defun riece-propertize-modeline-string (string &rest properties)
+  (add-text-properties string properties)
+  string)
+
 (provide 'riece-emacs)
 
 ;;; riece-emacs.el ends here
index 09d8b72..4803efb 100644 (file)
 (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))))
+      (let ((string (riece-format-identity identity))
+           (start 0)
+           extent)
+       ;; Escape % -> %%.
+       (while (string-match "%" string start)
+         (setq start (1+ (match-end 0))
+               string (replace-match "%%" nil nil string)))
+       (list (format "%d:" index)
+             (riece-propertize-modeline-string
+              string 'face 'riece-channel-list-current-face)))))
 
 (defun riece-highlight-insinuate ()
   (put 'riece-channel-mode 'font-lock-defaults
index a47833e..6541feb 100644 (file)
                                                                 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))))
+      (let ((string (riece-format-identity identity))
+           (start 0)
+           extent)
+       ;; Escape % -> %%.
+       (while (string-match "%" string start)
+         (setq start (1+ (match-end 0))
+               string (replace-match "%%" nil nil string)))
+       (list (format "%d:" index)
+             (riece-propertize-modeline-string
+              string 'face 'riece-channel-list-history-face)))))
 
 ;;; (defun riece-history-requires ()
 ;;;   (if (memq 'riece-guess riece-addons)
index d453727..4f874f5 100644 (file)
 
 (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))))
+      (let ((string (riece-format-identity identity))
+           (start 0)
+           extent)
+       ;; Escape % -> %%.
+       (while (string-match "%" string start)
+         (setq start (1+ (match-end 0))
+               string (replace-match "%%" nil nil string)))
+       (list (format "%d:" index)
+             (riece-propertize-modeline-string
+              string 'face 'riece-channel-list-unread-face)))))
 
 (defun riece-unread-switch-to-channel ()
   (interactive)
index b1d7349..119cabe 100644 (file)
 (defun riece-match-string-no-properties (number &optional string)
   (format "%s" (match-string number string)))
 
+(defun riece-propertize-modeline-string (string &rest properties)
+  (let ((extent (make-extent nil nil)))
+    (set-extent-properties extent properties)
+    (cons extent string)))
+
 (provide 'riece-xemacs)
 
 ;;; riece-xemacs.el ends here