From a406cad44e6aa3612cefc70e82c8dde5f2e29541 Mon Sep 17 00:00:00 2001
From: "Jason F. McBrayer" <McBrayerJ@dnr.sc.gov>
Date: Tue, 12 Feb 2013 15:27:27 -0500
Subject: [PATCH 3/3] Update handling of faces to respect customization

Previously, faces were reset at various times to values based on
customized variables. This meant, among other things, that customizing
the face itself had no effect.

In order to KISS, I've removed the variables entirely. This may or may
not be the correct thing to do, but it avoids potentially confusing
interaction between customizing variables and customizing faces.
---
 identica-mode.el |   72 ++++++++++++++++++------------------------------------
 1 files changed, 24 insertions(+), 48 deletions(-)

diff --git a/identica-mode.el b/identica-mode.el
index e8257b0..df2c556 100644
--- a/identica-mode.el
+++ b/identica-mode.el
@@ -420,26 +420,27 @@ of identica-stripe-face."
   :type 'boolean
   :group 'identica-mode)
 
-(defvar identica-username-face 'identica-username-face)
-(defvar identica-uri-face 'identica-uri-face)
-(defvar identica-reply-face 'identica-reply-face)
-(defvar identica-stripe-face 'identica-stripe-face)
-(defvar identica-highlight-face 'identica-highlight-face)
-
-(defcustom identica-reply-bg-color "DarkSlateGray"
-  "The background color on which replies are displayed."
-  :type 'string
-  :group 'identica-mode)
 
-(defcustom identica-stripe-bg-color "SlateGray"
-  "The background color on which striped entries are displayed."
-  :type 'string
-  :group 'identica-mode)
+;;; Faces
+(defface identica-username
+  `((t :underline t))
+  "Face for usernames in identica-mode timelines" :group 'faces)
+(defface identica-reply
+  `((t :background "DarkSlateGray"))
+  "Face for replies in identica-mode timelines" :group 'faces)
+(defface identica-stripe
+  `((t :background "SlateGray"))
+  "Face for alternating stripes in identica-mode timelines" :group 'faces)
+(defface identica-highlight
+  `((t :background "DarkSlateGray"))
+  "Face for highlights in identica-mode timelines" :group 'faces)
+(defface identica-uri
+  `((t :underline t))
+  "Face for URIs in identica-mode timelines" :group 'faces)
+(defface identica-heart
+  `((t :foreground "firebrick1" :height 2.0))
+  "Face for favorited posts in identica-mode timelines" :group 'faces)
 
-(defcustom identica-highlight-bg-color "DarkSlateGray"
-  "The background color on which highlighted entries are displayed."
-  :type 'string
-  :group 'identica-mode)
 
 ;;; Proxy
 (defvar identica-proxy-use nil)
@@ -616,20 +617,7 @@ of identica-stripe-face."
   ;; (setq variable nil)
   (make-variable-buffer-local 'identica-active-mode)
   (set-default 'identica-active-mode t)
-  (font-lock-mode -1)
-  (defface identica-username-face
-    `((t nil)) "" :group 'faces)
-  (defface identica-reply-face
-    `((t nil)) "" :group 'faces)
-  (defface identica-stripe-face
-    `((t nil)) "" :group 'faces)
-  (defface identica-highlight-face
-    `((t nil)) "" :group 'faces)
-  (defface identica-uri-face
-    `((t nil)) "" :group 'faces)
-  (defface identica-heart-face
-    `((t nil)) "" :group 'faces)
-
+  ;;(font-lock-mode -1)
   (add-to-list 'minor-mode-alist '(identica-icon-mode " id-icon"))
   (add-to-list 'minor-mode-alist '(identica-scroll-mode " id-scroll"))
 
@@ -1045,18 +1033,6 @@ we are interested in."
 
 (defun identica-render-timeline ()
   (with-current-buffer (identica-buffer)
-    (set-face-attribute 'identica-username-face nil
-                        :underline t)
-    (set-face-attribute 'identica-reply-face nil
-                        :background identica-reply-bg-color)
-    (set-face-attribute 'identica-stripe-face nil
-                        :background identica-stripe-bg-color)
-    (set-face-attribute 'identica-highlight-face nil
-                        :background identica-highlight-bg-color)
-    (set-face-attribute 'identica-uri-face nil
-                        :underline t)
-    (set-face-attribute 'identica-heart-face nil
-                        :foreground "firebrick1" :height 2.0)
     (let ((point (point))
           (end (point-max))
           (wrapped (cond (visual-line-mode 'visual-line-mode)
@@ -1090,12 +1066,12 @@ we are interested in."
                             (string-match
                              (concat "@" (sn-account-username sn-current-account)
                                      "\\([^[:word:]_-]\\|$\\)") (assoc-default 'text status)))
-                    (merge-text-attribute before-status (point) 'identica-reply-face :background))
+                    (merge-text-attribute before-status (point) 'identica-reply :background))
                   (when (and identica-enable-highlighting
                              (memq (assoc-default 'id status) identica-highlighted-entries))
-                    (merge-text-attribute before-status (point) 'identica-highlight-face :background))
+                    (merge-text-attribute before-status (point) 'identica-highlight :background))
                   (when stripe-entry
-                    (merge-text-attribute before-status (point) 'identica-stripe-face :background))
+                    (merge-text-attribute before-status (point) 'identica-stripe :background))
                   (when identica-oldest-first (goto-char (point-min))))))
             identica-timeline-data)
       (when (and identica-image-stack window-system) (clear-image-cache))
@@ -1241,7 +1217,7 @@ we are interested in."
           ((?h)
            (let ((likes (attr 'favorited)))
              (when (string= "true" likes)
-               (push (propertize "❤" 'face 'identica-heart-face) result))))
+               (push (propertize "❤" 'face 'identica-heart) result))))
           (t
            (push (char-to-string c) result))))
       (push (substring format-str cursor) result)
-- 
1.7.9

