From: Ian Kelling Date: Fri, 18 Apr 2014 02:20:19 +0000 (-0700) Subject: Refactor address lines to use first found instead of leaving blanks X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=0048a23895646a030f988b06333e8ba77ba86104;p=bbdb-csv-import Refactor address lines to use first found instead of leaving blanks --- diff --git a/bbdb3-csv-import.el b/bbdb3-csv-import.el index 8b66c73..ab72bac 100644 --- a/bbdb3-csv-import.el +++ b/bbdb3-csv-import.el @@ -214,7 +214,7 @@ Adds email labels as custom fields.") Based on 'Export for outlook.com and other services', not the export for Outlook 2010 and 2013.") -;;(defconst bbdb3-csv-import-combined) +;(defconst bbdb3-csv-import-combined) (defvar bbdb3-csv-import-mapping-table nil @@ -328,12 +328,13 @@ Defaults to current buffer." (cons e (cadr list)))) ;; change from (a b) to (a . b) (rd #'assoc-expand (map-bbdb3 "xfields")))) (address (rd (lambda (mapping-elem) - (let ((address-lines (mapcar-assoc (caadr mapping-elem))) + (let ((address-lines (rd (lambda (elem) + (assoc-plus elem csv-record)) + (caadr mapping-elem))) (address-data (mapcar-assoc (cdadr mapping-elem))) (elem-name (car mapping-elem))) - ;; outlook-web has 1 address line, bbdb requires 2 (if (= (length address-lines) 1) - (setq address-lines (append address-lines '("")))) + (setq address-lines (-snoc address-lines ""))) (when (consp elem-name) (setq elem-name (cdr (assoc (car elem-name) csv-record)))) @@ -352,7 +353,6 @@ Defaults to current buffer." (bbdb-create-internal name affix aka organization mail phone address xfields t)))) (setq bbdb-allow-duplicates initial-duplicate-value))) - (defun bbdb3-csv-import-flatten1 (list) "flatten LIST by 1 level." (--reduce-from (if (consp it)