small doc update
[bbdb-csv-import] / bbdb3-csv-import.el
index b8cc1a47fa5c92d6db90d770a83c4eaa64e2b749..ec782afe678a4318ac0836ee7d51ac1933ea413e 100644 (file)
 
 ;;; Installation:
 ;;
 
 ;;; Installation:
 ;;
-;; Install bbdb version 3+ (dunno exact min version)
-;; 
-;; If you used a package manager, just
+;; Install bbdb. If you installed this file with a package manager, just
 ;; 
 ;; (require 'bbdb3-csv-import)
 ;;
 ;; Else, note the min versions of dependencies above in "Package-Requires:",
 ;; 
 ;; (require 'bbdb3-csv-import)
 ;;
 ;; Else, note the min versions of dependencies above in "Package-Requires:",
-;; and load this file.
+;; and load this file. I don't know the exact minimum bbdb version.
 
 ;;; Usage:
 ;;
 
 ;;; Usage:
 ;;
 (require 'bbdb-com)
 (eval-when-compile (require 'cl))
 
 (require 'bbdb-com)
 (eval-when-compile (require 'cl))
 
-(defvar bbdb3-csv-import-mapping-table bbdb3-csv-import-combined
-  "The table which maps bbdb3 fields to csv fields. The default should work for most cases.
-See the commentary section of this file for more details.
-")
 
 (defconst bbdb3-csv-import-thunderbird
   '(("firstname" "First Name")
 
 (defconst bbdb3-csv-import-thunderbird
   '(("firstname" "First Name")
@@ -199,12 +193,6 @@ See the commentary section of this file for more details.
    people don't use those labels and using the default labels
    would create useless custom fields.")
 
    people don't use those labels and using the default labels
    would create useless custom fields.")
 
-(defconst bbdb3-csv-import-outlook-typed-email
-  (append  (car (last bbdb3-csv-import-outlook-web)) '((repeat "E-mail 1 - Type")))
-  "Like the previous var, but for outlook-web.
-Adds email labels as custom fields.")
-
-
 (defconst bbdb3-csv-import-outlook-web
   '(("firstname" "First Name")
     ("lastname" "Last Name")
 (defconst bbdb3-csv-import-outlook-web
   '(("firstname" "First Name")
     ("lastname" "Last Name")
@@ -239,6 +227,32 @@ Adds email labels as custom fields.")
 Based on 'Export for outlook.com and other services',
 not the export for Outlook 2010 and 2013.")
 
 Based on 'Export for outlook.com and other services',
 not the export for Outlook 2010 and 2013.")
 
+(defconst bbdb3-csv-import-outlook-typed-email
+  (append  (car (last bbdb3-csv-import-outlook-web)) '((repeat "E-mail 1 - Type")))
+  "Like the previous var, but for outlook-web.
+Adds email labels as custom fields.")
+
+
+(defun bbdb3-csv-import-flatten1 (list)
+  "flatten LIST by 1 level."
+  (--reduce-from (if (consp it)
+                     (-concat acc it)
+                   (-snoc acc it))
+                 nil list))
+
+
+(defun bbdb3-csv-import-merge-map (root)
+  "Combine two root mappings."
+  (bbdb3-csv-import-flatten1
+   (list root
+         (-distinct
+          (append
+           (cdr (assoc root bbdb3-csv-import-thunderbird))
+           (cdr (assoc root bbdb3-csv-import-linkedin))
+           (cdr (assoc root bbdb3-csv-import-gmail))
+           (cdr (assoc root bbdb3-csv-import-outlook-web)))))))
+
+
 (defconst bbdb3-csv-import-combined
   (list
    (bbdb3-csv-import-merge-map "firstname")
 (defconst bbdb3-csv-import-combined
   (list
    (bbdb3-csv-import-merge-map "firstname")
@@ -274,16 +288,9 @@ not the export for Outlook 2010 and 2013.")
    (bbdb3-csv-import-merge-map "organization")
    (bbdb3-csv-import-merge-map "xfields")))
 
    (bbdb3-csv-import-merge-map "organization")
    (bbdb3-csv-import-merge-map "xfields")))
 
-(defun bbdb3-csv-import-merge-map (root)
-  (bbdb3-csv-import-flatten1
-   (list root
-         (-distinct
-          (append
-           (cdr (assoc root bbdb3-csv-import-thunderbird))
-           (cdr (assoc root bbdb3-csv-import-linkedin))
-           (cdr (assoc root bbdb3-csv-import-gmail))
-           (cdr (assoc root bbdb3-csv-import-outlook-web)))))))
-
+(defvar bbdb3-csv-import-mapping-table bbdb3-csv-import-combined
+  "The table which maps bbdb3 fields to csv fields. The default should work for most cases.
+See the commentary section of this file for more details.")
 
 
 ;;;###autoload
 
 
 ;;;###autoload
@@ -292,7 +299,6 @@ not the export for Outlook 2010 and 2013.")
   (interactive "fCSV file containg contact data: ")
   (bbdb3-csv-import-buffer (find-file-noselect filename)))
 
   (interactive "fCSV file containg contact data: ")
   (bbdb3-csv-import-buffer (find-file-noselect filename)))
 
-
 ;;;###autoload
 (defun bbdb3-csv-import-buffer (&optional buffer-or-name) 
   "Parse and import csv BUFFER-OR-NAME to bbdb3.
 ;;;###autoload
 (defun bbdb3-csv-import-buffer (&optional buffer-or-name) 
   "Parse and import csv BUFFER-OR-NAME to bbdb3.
@@ -418,15 +424,7 @@ Defaults to current buffer."
           (bbdb-create-internal name affix aka organization mail phone address xfields t))))
     (setq bbdb-allow-duplicates initial-duplicate-value)))
 
           (bbdb-create-internal name affix aka organization mail phone address xfields t))))
     (setq bbdb-allow-duplicates initial-duplicate-value)))
 
-;;;###autoload
-(defun bbdb3-csv-import-flatten1 (list)
-  "flatten LIST by 1 level."
-  (--reduce-from (if (consp it)
-                     (-concat acc it)
-                   (-snoc acc it))
-                 nil list))
 
 
-;;;###autoload
 (defun bbdb3-csv-import-rd (func list)
   "like mapcar but don't build nil results into the resulting list"
   (--reduce-from (let ((funcreturn (funcall func it)))
 (defun bbdb3-csv-import-rd (func list)
   "like mapcar but don't build nil results into the resulting list"
   (--reduce-from (let ((funcreturn (funcall func it)))
@@ -435,7 +433,6 @@ Defaults to current buffer."
                      acc))
                  nil list))
 
                      acc))
                  nil list))
 
-;;;###autoload
 (defun bbdb3-csv-import-assoc-plus (key list)
   "Like (cdr assoc ...) but turn an empty string result to nil."
   (let ((result (cdr (assoc key list))))
 (defun bbdb3-csv-import-assoc-plus (key list)
   "Like (cdr assoc ...) but turn an empty string result to nil."
   (let ((result (cdr (assoc key list))))