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
(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 ()
(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
(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
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)
(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)
(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