From: ueno Date: Tue, 26 Aug 2003 02:18:30 +0000 (+0000) Subject: * riece-unread.el: Require 'riece-highlight when compiling. X-Git-Tag: riece-0_1_1~16 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=846e0f82319d24f704ff2a987f2a8c381e01b4a2;p=elisp%2Friece.git * riece-unread.el: Require 'riece-highlight when compiling. (riece-unread): New custom group. (riece-channel-list-unread-face): New variable. (riece-channel-list-unread-face): New face. (riece-unread-requires): New function. (riece-unread-insinuate): Add ?! to riece-channel-list-mark-face-alist. * riece-highlight.el: Highlight *Channels* buffer; rename riece-*-face -> riece-dialogue-*-face, riece-highlight-* -> riece-dialogue-*. (riece-channel-list-font-lock-keywords): New variable. (riece-channel-list-mark-face-alist): New variable. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8e302aa..4d02ae7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2003-08-26 Daiki Ueno + + * riece-unread.el: Require 'riece-highlight when compiling. + (riece-unread): New custom group. + (riece-channel-list-unread-face): New variable. + (riece-channel-list-unread-face): New face. + (riece-unread-requires): New function. + (riece-unread-insinuate): Add ?! to riece-channel-list-mark-face-alist. + + * riece-highlight.el: Highlight *Channels* buffer; rename + riece-*-face -> riece-dialogue-*-face, riece-highlight-* -> + riece-dialogue-*. + (riece-channel-list-font-lock-keywords): New variable. + (riece-channel-list-mark-face-alist): New variable. + 2003-08-25 Daiki Ueno * riece-unread.el (riece-unread-update-channel-list-buffer): diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index 76ff4a4..a9e31db 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -39,42 +39,42 @@ :prefix "riece-highlight-" :group 'riece-highlight) -(defcustom riece-change-face 'riece-change-face +(defcustom riece-dialogue-change-face 'riece-dialogue-change-face "Face used for displaying \"*** Change:\" line." :type 'face :group 'riece-highlight-faces) -(defcustom riece-notice-face 'riece-notice-face +(defcustom riece-dialogue-notice-face 'riece-dialogue-notice-face "Face used for displaying \"*** Notice:\" line." :type 'face :group 'riece-highlight-faces) -(defcustom riece-wallops-face 'riece-wallops-face +(defcustom riece-dialogue-wallops-face 'riece-dialogue-wallops-face "Face used for displaying \"*** Wallops:\" line." :type 'face :group 'riece-highlight-faces) -(defcustom riece-error-face 'riece-error-face +(defcustom riece-dialogue-error-face 'riece-dialogue-error-face "Face used for displaying \"*** Error:\" line." :type 'face :group 'riece-highlight-faces) -(defcustom riece-info-face 'riece-info-face +(defcustom riece-dialogue-info-face 'riece-dialogue-info-face "Face used for displaying \"*** Info:\" line." :type 'face :group 'riece-highlight-faces) -(defcustom riece-server-face 'riece-server-face +(defcustom riece-dialogue-server-face 'riece-dialogue-server-face "Face used for displaying \"(from server)\" extent." :type 'face :group 'riece-highlight-faces) -(defcustom riece-prefix-face 'riece-prefix-face +(defcustom riece-dialogue-prefix-face 'riece-dialogue-prefix-face "Face used for displaying \"\" extent." :type 'face :group 'riece-highlight-faces) -(defface riece-change-face +(defface riece-dialogue-change-face '((((class color) (background dark)) (:foreground "cyan" :bold t)) @@ -86,7 +86,7 @@ "Face used for displaying \"*** Change:\" line" :group 'riece-highlight-faces) -(defface riece-notice-face +(defface riece-dialogue-notice-face '((((class color) (background dark)) (:foreground "green2" :bold t)) @@ -98,7 +98,7 @@ "Face used for displaying \"*** Notice:\" line" :group 'riece-highlight-faces) -(defface riece-wallops-face +(defface riece-dialogue-wallops-face '((((class color) (background dark)) (:foreground "yellow" :bold t)) @@ -110,7 +110,7 @@ "Face used for displaying \"*** Wallops:\" line" :group 'riece-highlight-faces) -(defface riece-error-face +(defface riece-dialogue-error-face '((((class color) (background dark)) (:foreground "cornflower blue" :bold t)) @@ -122,7 +122,7 @@ "Face used for displaying \"*** Error:\" line" :group 'riece-highlight-faces) -(defface riece-info-face +(defface riece-dialogue-info-face '((((class color) (background dark)) (:foreground "PaleTurquoise" :bold t)) @@ -134,7 +134,7 @@ "Face used for displaying \"*** Info:\" line" :group 'riece-highlight-faces) -(defface riece-server-face +(defface riece-dialogue-server-face '((((class color) (background dark)) (:foreground "Gray70")) @@ -146,7 +146,7 @@ "Face used for displaying \"(from server)\" extent." :group 'riece-highlight-faces) -(defface riece-prefix-face +(defface riece-dialogue-prefix-face '((((class color) (background dark)) (:foreground "moccasin")) @@ -158,11 +158,11 @@ "Face used for displaying \"\" extent" :group 'riece-highlight-faces) -(defcustom riece-highlight-font-lock-keywords +(defcustom riece-dialogue-font-lock-keywords (append (list (list (concat "^" riece-time-prefix-regexp "\\(<[^>]+>\\|>[^<]+<\\|([^)]+)\\|{[^}]+}\\|=[^=]+=\\)") - '(1 riece-prefix-face append t))) + '(1 riece-dialogue-prefix-face append t))) ;; set property to the whole line (mapcar (lambda (line) @@ -172,25 +172,61 @@ (regexp-quote (symbol-value (intern (format "riece-%s-prefix" line)))) ".*\\)$") - (list 1 (intern (format "riece-%s-face" line)) t t))) + (list 1 (intern (format "riece-dialogue-%s-face" line)) t t))) '(change notice wallops error info)) - (list (list "(from [^)]+)$" 0 riece-server-face t))) - "Normal and deformed faces for IRC normal line." + (list (list "(from [^)]+)$" 0 riece-dialogue-server-face t))) + "Default expressions to highlight in riece-dialogue-mode." :type '(repeat (list string)) :group 'riece-highlight) -(defun riece-highlight-schedule-turn-on-font-lock () +(defcustom riece-channel-list-current-face 'riece-channel-list-current-face + "Face used for displaying the current channel." + :type 'face + :group 'riece-highlight-faces) + +(defface riece-channel-list-current-face + '((((class color) + (background dark)) + (:foreground "PaleGreen" :underline t)) + (((class color) + (background light)) + (:foreground "DarkGreen" :underline t)) + (t + (:underline t))) + "Face used for displaying the current channel." + :group 'riece-highlight-faces) + +(defcustom riece-channel-list-mark-face-alist + '((?* . riece-channel-list-current-face)) + "An alist mapping marks on riece-channel-list-buffer to faces." + :type 'list + :group 'riece-highlight) + +(defcustom riece-channel-list-font-lock-keywords + '(("^[ 0-9][0-9]:\\(.\\)\\(.*\\)" + (2 (or (cdr (assq (aref (match-string 1) 0) + riece-channel-list-mark-face-alist)) + 'default)))) + "Default expressions to highlight in riece-channel-list-mode." + :type '(repeat (list string)) + :group 'riece-highlight) + +(defun riece-dialogue-schedule-turn-on-font-lock () (add-hook 'riece-channel-mode-hook - 'riece-highlight-turn-on-font-lock) + 'riece-dialogue-turn-on-font-lock) (add-hook 'riece-others-mode-hook - 'riece-highlight-turn-on-font-lock) + 'riece-dialogue-turn-on-font-lock) (add-hook 'riece-dialogue-mode-hook - 'riece-highlight-turn-on-font-lock)) + 'riece-dialogue-turn-on-font-lock)) + +(defun riece-channel-list-schedule-turn-on-font-lock () + (add-hook 'riece-channel-list-mode-hook + 'riece-channel-list-turn-on-font-lock)) (defvar font-lock-support-mode) -(defun riece-highlight-turn-on-font-lock () +(defun riece-dialogue-turn-on-font-lock () (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults '(riece-highlight-font-lock-keywords t)) + (setq font-lock-defaults '(riece-dialogue-font-lock-keywords t)) (make-local-variable 'font-lock-verbose) (setq font-lock-verbose nil) (when (boundp 'font-lock-support-mode) @@ -201,23 +237,39 @@ (turn-on-font-lock) (make-local-hook 'after-change-functions) (add-hook 'after-change-functions - 'riece-highlight-hide-prefix nil 'local)) + 'riece-dialogue-hide-prefix nil 'local)) -(defun riece-highlight-hide-prefix (start end length) +(defun riece-dialogue-hide-prefix (start end length) (save-excursion (goto-char start) (if (looking-at riece-prefix-regexp) (put-text-property (match-beginning 1) (match-end 1) 'invisible t)))) +(defun riece-channel-list-turn-on-font-lock () + (make-local-variable 'font-lock-defaults) + (setq font-lock-defaults '(riece-channel-list-font-lock-keywords t)) + (make-local-variable 'font-lock-verbose) + (setq font-lock-verbose nil) + (when (boundp 'font-lock-support-mode) + (make-local-variable 'font-lock-support-mode) + (setq font-lock-support-mode nil)) + (make-local-hook 'font-lock-mode-hook) + (setq font-lock-mode-hook nil) + (turn-on-font-lock)) + (defun riece-highlight-insinuate () (put 'riece-channel-mode 'font-lock-defaults - '(riece-highlight-font-lock-keywords t)) + '(riece-dialogue-font-lock-keywords t)) (put 'riece-others-mode 'font-lock-defaults - '(riece-highlight-font-lock-keywords t)) + '(riece-dialogue-font-lock-keywords t)) (put 'riece-dialogue-mode 'font-lock-defaults - '(riece-highlight-font-lock-keywords t)) + '(riece-dialogue-font-lock-keywords t)) + (add-hook 'riece-after-load-startup-hook + 'riece-dialogue-schedule-turn-on-font-lock) + (put 'riece-channel-list-mode 'font-lock-defaults + '(riece-channel-list-font-lock-keywords t)) (add-hook 'riece-after-load-startup-hook - 'riece-highlight-schedule-turn-on-font-lock)) + 'riece-channel-list-schedule-turn-on-font-lock)) (provide 'riece-highlight) diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index cb27d97..cbeb005 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -34,6 +34,31 @@ (require 'riece-message) (require 'riece-commands) +(eval-when-compile (require 'riece-highlight)) + +(defgroup riece-unread nil + "Mark unread channels" + :tag "Unread" + :prefix "riece-" + :group 'riece) + +(defcustom riece-channel-list-unread-face 'riece-channel-list-unread-face + "Face used for displaying unread channels." + :type 'face + :group 'riece-highlight-faces) + +(defface riece-channel-list-unread-face + '((((class color) + (background dark)) + (:foreground "pink")) + (((class color) + (background light)) + (:foreground "firebrick")) + (t + ())) + "Face used for displaying unread channels." + :group 'riece-highlight-faces) + (defvar riece-unread-channels nil) (defun riece-unread-display-message-function (message) @@ -80,6 +105,10 @@ (defvar riece-dialogue-mode-map) (defvar riece-channel-list-mode-map) +(defun riece-unread-requires () + (if (memq 'riece-highlight riece-addons) + '(riece-highlight))) + (defun riece-unread-insinuate () (add-hook 'riece-after-display-message-functions 'riece-unread-display-message-function) @@ -92,7 +121,11 @@ (define-key riece-dialogue-mode-map "u" 'riece-unread-switch-to-channel) (define-key riece-channel-list-mode-map - "u" 'riece-unread-switch-to-channel)) + "u" 'riece-unread-switch-to-channel) + (if (memq 'riece-highlight riece-addons) + (setq riece-channel-list-mark-face-alist + (cons '(?! . riece-channel-list-unread-face) + riece-channel-list-mark-face-alist)))) (provide 'riece-unread)