[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb f64c791 347/350: Add internationalized version of
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb f64c791 347/350: Add internationalized version of ebdb-string for addresses |
Date: |
Mon, 14 Aug 2017 11:47:08 -0400 (EDT) |
branch: externals/ebdb
commit f64c791b402b4110c8b5d27359c5d4ee577fe636
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Add internationalized version of ebdb-string for addresses
* ebdb-i18n.el (ebdb-string): This is important to have.
There's also an internationalized version of ebdb-parse for addresses
in there, but since there's no *non-internationalized* version of
ebdb-parse for addresses, it's commented out for now.
---
ebdb-i18n.el | 65 ++++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 52 insertions(+), 13 deletions(-)
diff --git a/ebdb-i18n.el b/ebdb-i18n.el
index 251a92b..27df4ea 100644
--- a/ebdb-i18n.el
+++ b/ebdb-i18n.el
@@ -680,6 +680,45 @@ for their symbol representations.")
(plist-put slots :country country))))
(cl-call-next-method class slots obj)))
+(cl-defmethod ebdb-string :extra "i18n" ((adr ebdb-field-address))
+ "Internationally-aware version of `ebdb-string' for addresses."
+ (let ((cc (slot-value adr 'country)))
+ (or (and cc
+ (symbolp cc)
+ (condition-case nil
+ (ebdb-string-i18n adr cc)
+ (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))
+;; (append ebdb-i18n-countries-pref-scripts
+;; ebdb-i18n-countries)))
+;; str)
+;; (cdr-safe (assoc-string
+;; (match-string 0 str)
+;; (append ebdb-i18n-countries-pref-scripts
+;; 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))))
+
(cl-defmethod ebdb-read :extra "i18n" ((class (subclass ebdb-field-phone))
&optional slots obj)
(let ((country
@@ -689,23 +728,23 @@ for their symbol representations.")
"Country/Region: "
ebdb-i18n-phone-codes nil nil)
ebdb-i18n-phone-codes))))
- area-code)
- ;; Obviously this whole structure thing is just poorly
- ;; thought-out.
- (when (consp country)
- (cond ((numberp (car country))
- (setq area-code (cl-second country)
- country (car country)))
- ((consp (car country))
- (setq country (assoc
- (string-to-number
- (completing-read
- "Choose: "
+ area-code)
+ ;; Obviously this whole structure thing is just poorly
+ ;; thought-out.
+ (when (consp country)
+ (cond ((numberp (car country))
+ (setq area-code (cl-second country)
+ country (car country)))
+ ((consp (car country))
+ (setq country (assoc
+ (string-to-number
+ (completing-read
+ "Choose: "
(mapcar (lambda (x)
(number-to-string (car x)))
country)))
country)
- area-code (cl-second country))))
+ area-code (cl-second country))))
(when (consp area-code)
(setq area-code (string-to-number
(completing-read
- [elpa] externals/ebdb be9464d 319/350: When merging organization records, possibly merge role fields, (continued)
- [elpa] externals/ebdb be9464d 319/350: When merging organization records, possibly merge role fields, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 969c44c 303/350: Small tweaks to README, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 1df6476 322/350: Remove stray code, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8455b47 329/350: Bug in 851c0f1, signature snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5cfad1d 317/350: Don't need so much docstring on ebdb-mode, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb acaf3d0 350/350: Move the mail field sorting thing to a :before method, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2c05d6e 348/350: Wrong slot names when reading addresses, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a4e9f16 324/350: Also snarf URL fields, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 761dc23 346/350: Fix bug in searching by database, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6c13763 335/350: Don't require ebdb-chn from ebdb-i18n, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb f64c791 347/350: Add internationalized version of ebdb-string for addresses,
Eric Abrahamsen <=
- [elpa] externals/ebdb 2d74de4 345/350: Use autoload cookies on defclass statements, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a035748 318/350: Mention role fields in the manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5e25f5b 344/350: Remove Brian Edmonds' code until copyright resolved, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e555044 294/350: Expand manual, and edit for use of ox-texinfo-plus, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b9ac670 333/350: Add new manual section about writing MUA integration, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5fbc902 343/350: New option ebdb-i18n-countries-pref-scripts, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 84b348e 311/350: Basic finished version of manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 534d3b7 298/350: Start tracking manual texi and info files, Eric Abrahamsen, 2017/08/14