diff --git a/circe.el b/circe.el index 783ad3d..a6425bb 100644 --- a/circe.el +++ b/circe.el @@ -110,6 +110,17 @@ See the {topic-diff} parameter to `circe-format-server-topic'." See `circe-fool-list'." :group 'circe) +(defface circe-tracking-channel-face + nil + "The face used by circe-tracking to show channels with activity in modeline." + :group 'circe) + +(defface circe-tracking-query-face + nil + "The face used by circe-tracking to show query buffers with activity in +modeline." + :group 'circe) + ;;;;;;;;;;;;;;;;;;; ;;;; Variables ;;;; ;;;;;;;;;;;;;;;;;;; @@ -1556,6 +1567,19 @@ PATTERNS should be the list of regular expressions." (throw 'return t))) nil))) +(defun circe-tracking-get-face (buffer) + "Return face for a given buffer. If the buffer has already some face +specified, use it. This covers channels where our name was mentioned. Otherwise +decide whether the buffer is for a channel, query or else and use a face based +on this." + (with-current-buffer buffer + (cond ((get-text-property 0 'face buffer)) + ((eq major-mode 'circe-channel-mode) + 'circe-tracking-channel-face) + ((eq major-mode 'circe-query-mode) + 'circe-tracking-query-face) + (t (tracking-get-face buffer))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Nick Highlighting ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/tracking.el b/tracking.el index adc8cd5..2c13600 100644 --- a/tracking.el +++ b/tracking.el @@ -147,6 +147,14 @@ If set to nil, all buffers will be shown." (integer :tag "Maximum")) :group 'tracking) +(defcustom tracking-get-face-function #'tracking-get-face + "Function that returns face for a given buffer. It defaults to +`tracking-get-face' which simply returns any face that is stored in +`tracking-buffers'. Circe users may set this variable to +`circe-tracking-get-face' instead." + :type 'function + :group 'tracking) + ;;; Internal variables (defvar tracking-buffers nil "The list of currently tracked buffers.") @@ -361,7 +369,7 @@ only return that many entries, ending with '+n'." (while buffer-names (push `(:propertize ,(car shortened-names) - face ,(get-text-property 0 'face (car buffer-names)) + face ,(funcall tracking-get-face-function (car buffer-names)) keymap ,(let ((map (make-sparse-keymap))) (define-key map [mode-line down-mouse-1] `(lambda () @@ -447,5 +455,10 @@ This returns STRING with the new face." (propertize string 'face candidate)))) string))) +(defun tracking-get-face (buffer) + "Return face for a given buffer. If the buffer has already some face +specified, use it. Otherwise, return `nil'." + (get-text-property 0 'face buffer)) + (provide 'tracking) ;;; tracking.el ends here