[Top][All Lists]

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

[elpa] externals/ebdb c4ea244 021/350: Add new ebdb-field-id field

From: Eric Abrahamsen
Subject: [elpa] externals/ebdb c4ea244 021/350: Add new ebdb-field-id field
Date: Mon, 14 Aug 2017 11:45:55 -0400 (EDT)

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

    Add new ebdb-field-id field
    * ebdb.el (ebdb-field-id): Inherits ebdb-field-obfuscated, so won't
      display in the *EBDB* buffer.  Inherits ebdb-field-labeled.
      (ebdb-id-label-list): Label list for field instances.
 ebdb.el | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/ebdb.el b/ebdb.el
index b8c1d60..cf68f60 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -1451,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 
+  ((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]