[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 9acc6d4 4/9: Provide more control over faces in *E
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 9acc6d4 4/9: Provide more control over faces in *EBDB* buffers |
Date: |
Wed, 18 Oct 2017 17:51:57 -0400 (EDT) |
branch: externals/ebdb
commit 9acc6d4db30ae3972f6be6b49b540f6339937683
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Provide more control over faces in *EBDB* buffers
* ebdb-com.el (ebdb-phone-default, ebdb-address-default,
ebdb-mail-default): Provide default faces for the three main field
types. Other mail faces inherit from ebdb-mail-default.
(ebdb-fmt-field): Provide a few methods that apply the appropriate
face.
---
ebdb-com.el | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index ca43364..5796a01 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -127,13 +127,35 @@ Used by `ebdb-mouse-menu'."
'((t (:inherit font-lock-constant-face)))
"Face used for placeholder text for fields that aren't actually displayed.")
+(defface ebdb-phone-default '((t :inherit default))
+ "Base face used for all phone fields."
+ :group 'ebdb-faces)
+
+(defface ebdb-address-default '((t :inherit default))
+ "Base face used for all address fields."
+ :group 'ebdb-faces)
+
+(defface ebdb-mail-default '((t :inherit default :foreground purple))
+ "Base face used for all mail fields."
+ :group 'ebdb-faces)
+
(defface ebdb-defunct
'((t :foreground "gray80"))
- "Face used to display defunct roles and mails."
+ "Face used to display defunct things."
+ :group 'ebdb-faces)
+
+(defface ebdb-role-defunct
+ '((t :inherit ebdb-defunct))
+ "Face used to display defunct roles."
+ :group 'ebdb-faces)
+
+(defface ebdb-mail-defunct
+ '((t :inherit ebdb-mail-default ebdb-defunct))
+ "Face used to display a defunct mail address."
:group 'ebdb-faces)
(defface ebdb-mail-primary
- '((t (:inherit font-lock-builtin-face)))
+ '((t (:inherit ebdb-mail-default font-lock-builtin-face)))
"Face used to display a record's primary mail address."
:group 'ebdb-faces)
@@ -481,12 +503,26 @@ property is the field instance itself."
(value (ebdb-string field))
(face (cond
((eq priority 'primary) 'ebdb-mail-primary)
- ((eq priority 'defunct) 'ebdb-defunct)
- (t nil))))
+ ((eq priority 'defunct) 'ebdb-mail-defunct)
+ (t 'ebdb-mail-default))))
(if face
(propertize value 'face face)
value)))
+(cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
+ (_field ebdb-field-phone)
+ _style
+ (_record ebdb-record))
+ "Add an appropriate face to phones."
+ (propertize (cl-call-next-method) 'face 'ebdb-phone-default))
+
+(cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
+ (_field ebdb-field-address)
+ _style
+ (_record ebdb-record))
+ "Add an appropriate face to addresses."
+ (propertize (cl-call-next-method) 'face 'ebdb-address-default))
+
(cl-defmethod ebdb-fmt-field ((fmt ebdb-formatter-ebdb)
(field ebdb-field-role)
_style
@@ -503,7 +539,7 @@ property is the field instance itself."
(ebdb-fmt-field fmt mail 'oneline record))
rec-string)))
(if defunct
- (propertize value 'face 'ebdb-defunct)
+ (propertize value 'face 'ebdb-role-defunct)
value))))
(defsubst ebdb-indent-string (string column)
- [elpa] externals/ebdb updated (b0029d3 -> aac31a3), Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb e8c956d 1/9: Adjust database checks when loading, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 64dbf86 5/9: Bah, commited a bit of (erroneous) test code, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 94b11b9 2/9: Various tweaks, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb c6aef3b 3/9: Fix parsing of address countries during migration, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 9acc6d4 4/9: Provide more control over faces in *EBDB* buffers,
Eric Abrahamsen <=
- [elpa] externals/ebdb dcb1fcc 6/9: Turns out ebdb-fmt-collect-fields could have been a lot simpler, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 864c1f3 7/9: Give formatters a post-format-function slot, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb aac31a3 9/9: Add browse-url action for domain fields, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 1ebd9eb 8/9: Fix function call, Eric Abrahamsen, 2017/10/18