[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb e78dd19 10/17: Provide an ebdb-parse method for ad
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb e78dd19 10/17: Provide an ebdb-parse method for addresses |
Date: |
Tue, 26 Sep 2017 17:15:34 -0400 (EDT) |
branch: externals/ebdb
commit e78dd19203c39980516a3188844722e25348141b
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Provide an ebdb-parse method for addresses
* ebdb-i18n.el (ebdb-parse): This is a base ebdb-parse method, but
lives here because address parsing is only supported for
internationalized EBDB.
* ebdb-i18n-basic.el (ebdb-parse-i18n): Provide a base parsing method
for US addresses.
---
ebdb-i18n.el | 51 ++++++++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/ebdb-i18n.el b/ebdb-i18n.el
index 5dc26a3..c33800f 100644
--- a/ebdb-i18n.el
+++ b/ebdb-i18n.el
@@ -705,33 +705,30 @@ for their symbol representations."
(cl-no-method nil)))
(cl-call-next-method))))
-;; This method can be used later. Probably there will never be a
-;; non-i18n `ebdb-parse' method for addresses, because it's just too
-;; hard to guess if you don't know the country. At some point there
-;; should be an option called `ebdb-read-address-articulate': if that
-;; is nil, then we should require the user to have loaded `ebdb-i18n',
-;; and only international parse methods will be considered.
-
-;; (cl-defmethod ebdb-parse :extra "i18n" ((class (subclass
ebdb-field-address))
-;; (str string)
-;; &optional slots)
-;; "Internationally-aware version of `ebdb-parse' for addresses."
-;; (let ((cc (or (plist-get slots :country)
-;; (when (string-match (regexp-opt
-;; (mapcar
-;; (lambda (elt) (car elt))
-;; (ebdb-i18n-countries)))
-;; str)
-;; (cdr-safe (assoc-string
-;; (match-string 0 str)
-;; (ebdb-i18n-countries)
-;; ))))))
-;; (or (and cc
-;; (symbolp cc)
-;; (condition-case nil
-;; (ebdb-parse-i18n class str cc slots)
-;; (cl-no-method nil)))
-;; (cl-call-next-method))))
+;; This is not an :extra method, because there will never be a
+;; non-i18n `ebdb-parse' method for addresses. It's just too hard to
+;; guess if you don't know the country. This is only used in
+;; snarfing.
+
+(cl-defmethod ebdb-parse ((class (subclass ebdb-field-address))
+ (str string)
+ &optional slots)
+ "Internationally-aware version of `ebdb-parse' for addresses."
+ (let ((cc (or (plist-get slots :country)
+ (when (string-match (regexp-opt
+ (mapcar
+ (lambda (elt) (car elt))
+ (ebdb-i18n-countries)))
+ str)
+ (cdr-safe (assoc-string
+ (match-string 0 str)
+ (ebdb-i18n-countries)))))))
+ (or (and cc
+ (symbolp cc)
+ (condition-case nil
+ (ebdb-parse-i18n class str cc slots)
+ (cl-no-method nil)))
+ (signal 'ebdb-unparseable (list str)))))
(cl-defmethod ebdb-read :extra "i18n" ((class (subclass ebdb-field-phone))
&optional slots obj)
- [elpa] externals/ebdb 1abf847 02/17: Fix slot customize declaration for bank account field, (continued)
- [elpa] externals/ebdb 1abf847 02/17: Fix slot customize declaration for bank account field, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 2a17bb6 03/17: Set up EBDB buffers to offer save on save-some-buffers, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 26d632b 05/17: Finish ebdb-internationalize-addresses, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 3f1eb0d 04/17: New defsubst ebdb-i18n-countries, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb f143265 07/17: Quietly swap order of arguments to ebdb-read-i18n for addresses, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 880be9f 14/17: Fix to dumb mistakes in 8fc7b6d69, fast lookups, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb b371784 15/17: Change ebdb-vcard to use generic ebdb-field-tags, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb c5aac30 01/17: Change name of automatic save option, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb fb7e4d2 11/17: Add formatting for Russian phone numbers, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb e947f59 06/17: Drop postcode guards, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb e78dd19 10/17: Provide an ebdb-parse method for addresses,
Eric Abrahamsen <=
- [elpa] externals/ebdb 7e7d6cd 09/17: Start collecting random internationalized methods, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb e326805 08/17: Simplify address formatting, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 4f8e2a0 16/17: Use ebdb-i18n-countries defsubst in i18n address reading, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 91d73f8 17/17: Bump version to 0.3.3, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb 7c16983 12/17: Fix all when-let and if-let to use starred versions, Eric Abrahamsen, 2017/09/26
- [elpa] externals/ebdb bd7b45a 13/17: Revert "Use value of ebdb-mua-folder-list in VM splitting", Eric Abrahamsen, 2017/09/26