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

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

[elpa] externals/ebdb 5fe2bf6 020/350: Add ebdb-field-obfuscated abstrac


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 5fe2bf6 020/350: Add ebdb-field-obfuscated abstract field class
Date: Mon, 14 Aug 2017 11:45:54 -0400 (EDT)

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

    Add ebdb-field-obfuscated abstract field class
    
    * ebdb.el (ebdb-field-obfuscated): New abstract field class that
      doesn't do anything but prevent the field contents from being
      displayed in the *EBDB* buffer.
    * ebdb-com.el (ebdb-fmt-field): When formatting the field, display a
      bogus string instead.
      (ebdb-field-hidden): Font face for that bogus string.
---
 ebdb-com.el | 12 ++++++++++++
 ebdb.el     | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/ebdb-com.el b/ebdb-com.el
index d053368..5549740 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -156,6 +156,10 @@ Here a value may be the predefined function 
`ebdb-multiple-buffers-default'."
   "Face used for clickable links/URLs in field values."
   :group 'ebdb-faces)
 
+(defface ebdb-field-hidden
+  '((t (:inherit font-lock-constant-face)))
+  "Face used for placeholder text for fields that aren't actually displayed.")
+
 (defface ebdb-defunct
   '((t (:inherit font-lock-comment-face)))
   "Face used to display defunct roles and mails."
@@ -475,6 +479,14 @@ property is the field instance itself."
     value))
 
 (cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
+                             (field ebdb-field-obfuscated)
+                             _style
+                             (_record ebdb-record))
+  (let ((str "HIDDEN"))
+    (add-face-text-property 0 (length str) 'ebdb-field-hidden nil str)
+    str))
+
+(cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter-ebdb)
                              (field ebdb-field-mail)
                              _style
                              (_record ebdb-record))
diff --git a/ebdb.el b/ebdb.el
index 58f7d21..b8c1d60 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -823,6 +823,17 @@ process."
     (ebdb-add-to-list label-var (slot-value field 'object-name))
     (cl-call-next-method)))
 
+;;; The obfuscated field type.  This is a little goofy, but might come
+;;; in handy.
+
+(defclass ebdb-field-obfuscated (ebdb-field)
+  nil
+  :abstract t
+  :documentation
+  "A field class mixin that prevents the contents from being
+  displayed in the *EBDB* buffer.  Use for mildly sensitive
+  information.")
+
 ;;; User-defined fields.  There are two kinds.  The first is
 ;;; `ebdb-field-user', which provides no information about labels or
 ;;; slots, but simply gives us the right to live in the "fields" slot



reply via email to

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