branch: externals/ebdb commit 3f1eb0de6e34062ae0dfea401070df9d7f65ce4d Author: Eric Abrahamsen <e...@ericabrahamsen.net> Commit: Eric Abrahamsen <e...@ericabrahamsen.net>
New defsubst ebdb-i18n-countries * ebdb-i18n.el (ebdb-i18n-countries): Just appends the two alists ebdb-i18n-countries-pref-scripts and ebdb-i18n-countries. (ebdb-internationalize-addresses): Use. (ebdb-read): Use. * ebdb.el (ebdb-format-address): Use. --- ebdb-i18n.el | 19 ++++++++++--------- ebdb.el | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ebdb-i18n.el b/ebdb-i18n.el index 180ab0f..b94e9cd 100644 --- a/ebdb-i18n.el +++ b/ebdb-i18n.el @@ -335,6 +335,10 @@ English version for display." English, and a three-letter symbol identifying the country, as per ISO 3166-1 alpha 3.") +(defsubst ebdb-i18n-countries () + (append ebdb-i18n-countries-pref-scripts + ebdb-i18n-countries)) + ;; Taken from https://en.wikipedia.org/wiki/Telephone_country_codes, ;; on Jul 30, 2016 (defvar ebdb-i18n-phone-codes @@ -662,16 +666,14 @@ for their symbol representations.") (cl-defmethod ebdb-read :extra "i18n" ((class (subclass ebdb-field-address)) &optional slots obj) - (let* ((countries (append ebdb-i18n-countries-pref-scripts - ebdb-i18n-countries)) - (country + (let ((country (cdr (assoc (completing-read "Country: " countries nil nil (when obj (car (rassoc (ebdb-address-country obj) - countries)))) - ebdb-i18n-countries)))) + (ebdb-i18n-countries))))) + (ebdb-i18n-countries))))) (setq slots (condition-case nil (ebdb-read-i18n class @@ -705,13 +707,12 @@ for their symbol representations.") ;; (when (string-match (regexp-opt ;; (mapcar ;; (lambda (elt) (car elt)) -;; (append ebdb-i18n-countries-pref-scripts -;; ebdb-i18n-countries))) +;; (ebdb-i18n-countries))) ;; str) ;; (cdr-safe (assoc-string ;; (match-string 0 str) -;; (append ebdb-i18n-countries-pref-scripts -;; ebdb-i18n-countries))))))) +;; (ebdb-i18n-countries) +;; )))))) ;; (or (and cc ;; (symbolp cc) ;; (condition-case nil diff --git a/ebdb.el b/ebdb.el index 80c219f..bbe3656 100644 --- a/ebdb.el +++ b/ebdb.el @@ -53,6 +53,7 @@ (require 'eieio-opt) ;; Pacify the compiler. +(autoload 'ebdb-i18n-countries "ebdb-i18n") (autoload 'widget-group-match "wid-edit") (autoload 'ebdb-migrate-from-bbdb "ebdb-migrate") (autoload 'eieio-customize-object "eieio-custom") @@ -5032,8 +5033,7 @@ This function is a possible formatting function for (require 'ebdb-i18n) (setq country (car-safe (rassq country - (append ebdb-i18n-countries-pref-scripts - ebdb-i18n-countries))))) + (ebdb-i18n-countries))))) (concat (if streets (concat (mapconcat 'identity streets "\n") "\n")) (ebdb-concat ", " (ebdb-address-locality address)