From: ueno Date: Sun, 7 Mar 2004 09:59:46 +0000 (+0000) Subject: * riece-unread.el X-Git-Tag: signal-slot-mergepoint~3 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=baa4228524bf9ffe841a4239edd7a80f3608c25c;p=elisp%2Friece.git * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f433215..e37f53e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,28 @@ 2004-03-07 Daiki Ueno * 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 + + * riece-unread.el (riece-unread-format-identity-for-channel-list-indicator): New function. (riece-unread-insinuate): Setup diff --git a/lisp/riece-display.el b/lisp/riece-display.el index f8a5e59..19e6c8a 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -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 () diff --git a/lisp/riece-emacs.el b/lisp/riece-emacs.el index 0e49815..ea6be0a 100644 --- a/lisp/riece-emacs.el +++ b/lisp/riece-emacs.el @@ -91,6 +91,10 @@ (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 diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index 09d8b72..4803efb 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -236,11 +236,16 @@ (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 diff --git a/lisp/riece-history.el b/lisp/riece-history.el index a47833e..6541feb 100644 --- a/lisp/riece-history.el +++ b/lisp/riece-history.el @@ -82,11 +82,16 @@ 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) diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index d453727..4f874f5 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -83,11 +83,16 @@ (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) diff --git a/lisp/riece-xemacs.el b/lisp/riece-xemacs.el index b1d7349..119cabe 100644 --- a/lisp/riece-xemacs.el +++ b/lisp/riece-xemacs.el @@ -117,6 +117,11 @@ (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