From 5adccfc0b51674eee851d47f506cbe8f77a47bf7 Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 7 Mar 2004 09:00:51 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 26 ++++++++++++++++++++++++++ lisp/riece-display.el | 45 +++++++++++++++++++++++++++------------------ lisp/riece-highlight.el | 13 ++++++++++++- lisp/riece-history.el | 22 +++++++++++++++++----- lisp/riece-unread.el | 20 +++++++++++++++----- 5 files changed, 97 insertions(+), 29 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2ab89e9..f433215 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,31 @@ 2004-03-07 Daiki Ueno + * 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 + * 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 diff --git a/lisp/riece-display.el b/lisp/riece-display.el index b4f2ecf..f8a5e59 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -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"))) diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index 8eefc61..09d8b72 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -233,6 +233,15 @@ (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)) @@ -245,7 +254,9 @@ (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) diff --git a/lisp/riece-history.el b/lisp/riece-history.el index 4398410..a47833e 100644 --- a/lisp/riece-history.el +++ b/lisp/riece-history.el @@ -72,11 +72,21 @@ 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) @@ -95,8 +105,10 @@ (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) diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index 764bb63..d453727 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -76,10 +76,18 @@ (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) @@ -112,8 +120,10 @@ '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 -- 1.7.10.4