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

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

[elpa] externals/ebdb 9a2fd46 022/350: Merge branch 'master' into buff


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 9a2fd46 022/350: Merge branch 'master' into buff
Date: Mon, 14 Aug 2017 11:45:55 -0400 (EDT)

branch: externals/ebdb
commit 9a2fd466d07498dcdb7a57ba4c391c5cc6483945
Merge: 22734d1 c4ea244
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Merge branch 'master' into buff
---
 ebdb-com.el | 15 +++++++++++++--
 ebdb.el     | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 698e517..d3ba499 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -147,6 +147,10 @@ Used by `ebdb-mouse-menu'."
   "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."
@@ -471,6 +475,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))
@@ -1602,8 +1614,7 @@ is more than one), and prompt for the record class to 
use."
 (defun ebdb-create-record-extended ()
   (interactive)
   (let ((db
-        (if (or (= 1 (length ebdb-db-list))
-                (null arg))
+        (if (= 1 (length ebdb-db-list))
             (car ebdb-db-list)
           (ebdb-prompt-for-db)))
        (record-class
diff --git a/ebdb.el b/ebdb.el
index e1d479d..b17ed11 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
@@ -1440,6 +1451,32 @@ override parsing."
    (calendar-gregorian-from-absolute (slot-value ann 'date))
    nil t))
 
+;;; Id field
+
+;; Used for recording an ID or tax id number.  Ie, national
+;; identification numbers, SSNs, TINs, UTRs, and so on.
+
+(defvar ebdb-id-label-list '("SSN" "TIN" "ID" "UTR")
+  "List of known ID labels.")
+
+(defclass ebdb-field-id (ebdb-field-labeled ebdb-field-obfuscated 
ebdb-field-user)
+  ((label-list :initform ebdb-id-label-list)
+   (id-number
+    :type string
+    :custom string
+    :initarg :id-number
+    :initform ""
+    :documentation "The ID number itself."))
+  :human-readable "id number")
+
+(cl-defmethod ebdb-read ((class (subclass ebdb-field-id)) &optional slots obj)
+  (let ((id-number (ebdb-read-string "ID number: "
+                                    (when obj (slot-value obj 'id-number)))))
+    (cl-call-next-method class (plist-put slots :id-number id-number) obj)))
+
+(cl-defmethod ebdb-string ((field ebdb-field-id))
+  (slot-value field 'id-number))
+
 ;;; Relationship field
 
 ;; This is a bit different from the organization role field, mostly



reply via email to

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