diff --git a/tracking.el b/tracking.el index 0985ca0..f0762a6 100644 --- a/tracking.el +++ b/tracking.el @@ -147,6 +147,17 @@ If set to nil, all buffers will be shown." (integer :tag "Maximum")) :group 'tracking) +(defface tracking-channel-face + nil + "The face used by circe-tracking to show channels with activity in modeline." + :group 'circe) + +(defface tracking-query-face + nil + "The face used by circe-tracking to show query buffers with activity in +modeline." + :group 'circe) + ;;; Internal variables (defvar tracking-buffers nil "The list of currently tracked buffers.") @@ -361,7 +372,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 ,(tracking-get-face (car buffer-names)) keymap ,(let ((map (make-sparse-keymap))) (define-key map [mode-line down-mouse-1] `(lambda () @@ -446,5 +457,19 @@ 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. 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) + (get-text-property 0 'face buffer)) + ((eq major-mode 'circe-channel-mode) + 'tracking-channel-face) + ((eq major-mode 'circe-query-mode) + 'tracking-query-face) + (t nil)))) + (provide 'tracking) ;;; tracking.el ends here