X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-highlight.el;h=addb260ad2a882cffe7f640f02744fb5fb2251fc;hb=4bbf0d678d33ba4aafa5aa6ac458765774bee963;hp=a9e31db786408fca034ce6799874648c6410f57f;hpb=9bb15547ae1e13a67d2e33a509e7c59b0324f176;p=riece diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index a9e31db..addb260 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -1,4 +1,4 @@ -;;; riece-highlight.el --- coloring IRC buffers +;;; riece-highlight.el --- highlight IRC buffers ;; Copyright (C) 1998-2003 Daiki Ueno ;; Author: Daiki Ueno @@ -25,6 +25,8 @@ ;;; Code: (require 'riece-globals) +(require 'riece-options) ;riece-channel-list-buffer-mode +(require 'riece-identity) ;riece-format-identity (require 'font-lock) (defgroup riece-highlight nil @@ -39,41 +41,6 @@ :prefix "riece-highlight-" :group 'riece-highlight) -(defcustom riece-dialogue-change-face 'riece-dialogue-change-face - "Face used for displaying \"*** Change:\" line." - :type 'face - :group 'riece-highlight-faces) - -(defcustom riece-dialogue-notice-face 'riece-dialogue-notice-face - "Face used for displaying \"*** Notice:\" line." - :type 'face - :group 'riece-highlight-faces) - -(defcustom riece-dialogue-wallops-face 'riece-dialogue-wallops-face - "Face used for displaying \"*** Wallops:\" line." - :type 'face - :group 'riece-highlight-faces) - -(defcustom riece-dialogue-error-face 'riece-dialogue-error-face - "Face used for displaying \"*** Error:\" line." - :type 'face - :group 'riece-highlight-faces) - -(defcustom riece-dialogue-info-face 'riece-dialogue-info-face - "Face used for displaying \"*** Info:\" line." - :type 'face - :group 'riece-highlight-faces) - -(defcustom riece-dialogue-server-face 'riece-dialogue-server-face - "Face used for displaying \"(from server)\" extent." - :type 'face - :group 'riece-highlight-faces) - -(defcustom riece-dialogue-prefix-face 'riece-dialogue-prefix-face - "Face used for displaying \"\" extent." - :type 'face - :group 'riece-highlight-faces) - (defface riece-dialogue-change-face '((((class color) (background dark)) @@ -85,6 +52,7 @@ (:bold t))) "Face used for displaying \"*** Change:\" line" :group 'riece-highlight-faces) +(defvar riece-dialogue-change-face 'riece-dialogue-change-face) (defface riece-dialogue-notice-face '((((class color) @@ -97,6 +65,7 @@ (:bold t))) "Face used for displaying \"*** Notice:\" line" :group 'riece-highlight-faces) +(defvar riece-dialogue-notice-face 'riece-dialogue-notice-face) (defface riece-dialogue-wallops-face '((((class color) @@ -109,6 +78,7 @@ (:bold t))) "Face used for displaying \"*** Wallops:\" line" :group 'riece-highlight-faces) +(defvar riece-dialogue-wallops-face 'riece-dialogue-wallops-face) (defface riece-dialogue-error-face '((((class color) @@ -121,6 +91,7 @@ (:bold t))) "Face used for displaying \"*** Error:\" line" :group 'riece-highlight-faces) +(defvar riece-dialogue-error-face 'riece-dialogue-error-face) (defface riece-dialogue-info-face '((((class color) @@ -133,6 +104,7 @@ (:bold t))) "Face used for displaying \"*** Info:\" line" :group 'riece-highlight-faces) +(defvar riece-dialogue-info-face 'riece-dialogue-info-face) (defface riece-dialogue-server-face '((((class color) @@ -145,6 +117,7 @@ (:bold t))) "Face used for displaying \"(from server)\" extent." :group 'riece-highlight-faces) +(defvar riece-dialogue-server-face 'riece-dialogue-server-face) (defface riece-dialogue-prefix-face '((((class color) @@ -157,6 +130,7 @@ (:bold nil))) "Face used for displaying \"\" extent" :group 'riece-highlight-faces) +(defvar riece-dialogue-prefix-face 'riece-dialogue-prefix-face) (defcustom riece-dialogue-font-lock-keywords (append @@ -179,22 +153,24 @@ :type '(repeat (list string)) :group 'riece-highlight) -(defcustom riece-channel-list-current-face 'riece-channel-list-current-face - "Face used for displaying the current channel." - :type 'face +(defface riece-channel-list-default-face + '((t ())) + "Face used for displaying channels." :group 'riece-highlight-faces) +(defvar riece-channel-list-default-face 'riece-channel-list-default-face) (defface riece-channel-list-current-face '((((class color) (background dark)) - (:foreground "PaleGreen" :underline t)) + (:foreground "PaleTurquoise" :underline t)) (((class color) (background light)) - (:foreground "DarkGreen" :underline t)) + (:foreground "ForestGreen" :underline t)) (t - (:underline t))) + ())) "Face used for displaying the current channel." :group 'riece-highlight-faces) +(defvar riece-channel-list-current-face 'riece-channel-list-current-face) (defcustom riece-channel-list-mark-face-alist '((?* . riece-channel-list-current-face)) @@ -206,7 +182,7 @@ '(("^[ 0-9][0-9]:\\(.\\)\\(.*\\)" (2 (or (cdr (assq (aref (match-string 1) 0) riece-channel-list-mark-face-alist)) - 'default)))) + riece-channel-list-default-face)))) "Default expressions to highlight in riece-channel-list-mode." :type '(repeat (list string)) :group 'riece-highlight) @@ -245,6 +221,24 @@ (if (looking-at riece-prefix-regexp) (put-text-property (match-beginning 1) (match-end 1) 'invisible t)))) +(defun riece-channel-list-mark-current-channel (last) + (if (and riece-channel-list-buffer-mode + riece-current-channel) + (save-excursion + (set-buffer riece-channel-list-buffer) + (let ((inhibit-read-only t) + buffer-read-only) + (goto-char (point-min)) + (if (re-search-forward "^\\( ?[0-9]+:\\)\\*" nil t) + (replace-match "\\1 ")) + (goto-char (point-min)) + (if (re-search-forward + (concat + "^\\( ?[0-9]+:\\).\\(" + (regexp-quote (riece-format-identity riece-current-channel)) + "\\)$") nil t) + (replace-match "\\1*\\2")))))) + (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)) @@ -268,6 +262,8 @@ '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-switch-to-channel-functions + 'riece-channel-list-mark-current-channel) (add-hook 'riece-after-load-startup-hook 'riece-channel-list-schedule-turn-on-font-lock))