emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb bd9dd94 072/350: Use ebdb-defunct face on defunct


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb bd9dd94 072/350: Use ebdb-defunct face on defunct role fields
Date: Mon, 14 Aug 2017 11:46:05 -0400 (EDT)

branch: externals/ebdb
commit bd9dd94b2f74a5a6f0cc3df7777915af832d58e2
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Use ebdb-defunct face on defunct role fields
    
    * ebdb-com.el (ebdb-fmt-field): This defunct face is ugly.
---
 ebdb-com.el | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 6434bfc..9c882ce 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -501,25 +501,33 @@ property is the field instance itself."
                              (field ebdb-field-role)
                              _style
                              (record ebdb-record-organization))
-  (let ((person (ebdb-gethash (slot-value field 'record-uuid) 'uuid))
-       (mail (slot-value field 'mail)))
-    (if mail
-       (format "%s (%s)"
-               (ebdb-string person)
-               (ebdb-fmt-field fmt mail 'oneline record))
-      (ebdb-string person))))
+  (let* ((person (ebdb-gethash (slot-value field 'record-uuid) 'uuid))
+        (mail (slot-value field 'mail))
+        (value (copy-sequence
+                (if mail
+                    (format "%s (%s)"
+                            (ebdb-string person)
+                            (ebdb-fmt-field fmt mail 'oneline record))
+                  (ebdb-string person)))))
+    (when (slot-value field 'defunct)
+      (add-face-text-property 0 (length value) 'ebdb-defunct nil value))
+    value))
 
 (cl-defmethod ebdb-fmt-field ((fmt ebdb-formatter-ebdb)
                              (field ebdb-field-role)
                              _style
                              (record ebdb-record-person))
-  (let ((org (ebdb-gethash (slot-value field 'org-uuid) 'uuid))
-       (mail (slot-value field 'mail)))
-    (if mail
-       (format "%s (%s)"
-               (ebdb-string org)
-               (ebdb-fmt-field fmt mail 'oneline record))
-      (ebdb-string org))))
+  (let* ((org (ebdb-gethash (slot-value field 'org-uuid) 'uuid))
+        (mail (slot-value field 'mail))
+        (value (copy-sequence
+                (if mail
+                    (format "%s (%s)"
+                            (ebdb-string org)
+                            (ebdb-fmt-field fmt mail 'oneline record))
+                  (ebdb-string org)))))
+    (when (slot-value field 'defunct)
+      (add-face-text-property 0 (length value) 'ebdb-defunct nil value))
+    value))
 
 (defsubst ebdb-indent-string (string column)
   "Indent nonempty lines in STRING to COLUMN (except first line).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]