branch: externals/ebdb
commit d60744bba261f2732f9f6b490d95365896914f53
Author: Eric Abrahamsen <e...@ericabrahamsen.net>
Commit: Eric Abrahamsen <e...@ericabrahamsen.net>

    Fix calling of internationalized ebdb-parse, bump to 0.6.11
    
    * ebdb-i18n.el (ebdb-parse): All the ebdb-parse methods should be
    responsible for replacing the SLOTS argument for the parent methods,
    not returning objects themselves.
    * ebdb-i18n-basic.el (ebdb-parse-i18n): Trim whitespace from multiple
    street lines.
    * ebdb.el (ebdb-parse): Use plist-member instead of plist-get --
    someone might have set a nil value on purpose.
---
 ebdb-i18n-basic.el |  2 +-
 ebdb-i18n.el       | 42 +++++++++++++++++++++---------------------
 ebdb.el            |  8 ++++----
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/ebdb-i18n-basic.el b/ebdb-i18n-basic.el
index 24a3856..c0ecc78 100644
--- a/ebdb-i18n-basic.el
+++ b/ebdb-i18n-basic.el
@@ -158,7 +158,7 @@ number, and any remaining as an extension."
        (setq slots (plist-put slots :locality (match-string 1))))
       (setq slots (plist-put slots :streets
                             (split-string (buffer-substring (point-min) 
(point))
-                                          "[,\n]" t))))
+                                          "[,\n]" t "[[:blank:]]"))))
     slots))
 
 ;;; France
diff --git a/ebdb-i18n.el b/ebdb-i18n.el
index 4e9a84c..64cc85c 100644
--- a/ebdb-i18n.el
+++ b/ebdb-i18n.el
@@ -723,12 +723,11 @@ for their symbol representations."
                  (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)))))
+    (when (and cc (symbolp cc))
+      (condition-case nil
+         (setq slots (ebdb-parse-i18n class str cc slots))
+       (cl-no-method nil)))
+    (cl-call-next-method class str slots)))
 
 (cl-defmethod ebdb-read :extra "i18n" ((class (subclass ebdb-field-phone))
                                       &optional slots obj)
@@ -787,14 +786,15 @@ for their symbol representations."
         (cc (or (plist-get slots :country-code)
                 (and (string-match cc-reg str)
                      (string-to-number (match-string 1 str))))))
-    (or (and cc
-            (condition-case nil
-                (ebdb-parse-i18n
-                 class
-                 (replace-regexp-in-string cc-reg "" str)
-                 cc (plist-put slots :country-code cc))
-              (cl-no-method nil)))
-       (cl-call-next-method))))
+    (when cc
+      (condition-case nil
+         (setq slots
+               (ebdb-parse-i18n
+                class
+                (replace-regexp-in-string cc-reg "" str)
+                cc (plist-put slots :country-code cc)))
+       (cl-no-method nil)))
+    (cl-call-next-method class str slots)))
 
 ;; We don't need to override the `ebdb-read' method for names.  It
 ;; only matters what script the name is in if the user has set
@@ -807,13 +807,13 @@ for their symbol representations."
   ;; user has entered.
   (let ((script (unless (string-empty-p string)
                  (aref char-script-table (aref string 0)))))
-    (or (and script
-            (null (memq script ebdb-i18n-ignorable-scripts))
-            (condition-case nil
-                (ebdb-parse-i18n class string script slots)
-              (cl-no-method
-               nil)))
-       (cl-call-next-method))))
+    (when (and script
+              (null (memq script ebdb-i18n-ignorable-scripts)))
+      (condition-case nil
+         (setq slots (ebdb-parse-i18n class string script slots))
+       (cl-no-method
+        nil)))
+    (cl-call-next-method class string slots)))
 
 (cl-defmethod ebdb-string :extra "i18n" ((name ebdb-field-name-complex))
   (let* ((str (cl-call-next-method name))
diff --git a/ebdb.el b/ebdb.el
index 9280474..7bd1281 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2016-2019  Free Software Foundation, Inc.
 
-;; Version: 0.6.10
+;; Version: 0.6.11
 ;; Package-Requires: ((emacs "25.1") (cl-lib "0.5") (seq "2.15"))
 
 ;; Maintainer: Eric Abrahamsen <e...@ericabrahamsen.net>
@@ -1338,13 +1338,13 @@ first one."
 (cl-defmethod ebdb-parse ((class (subclass ebdb-field-name-complex)) str 
&optional slots)
   (pcase-let ((`(,surname ,given-names ,suffix)
               (ebdb-divide-name str)))
-    (unless (plist-get slots :given-names)
+    (unless (plist-member slots :given-names)
       (setq slots (plist-put slots :given-names
                             given-names)))
-    (unless (plist-get slots :surname)
+    (unless (plist-member slots :surname)
       (setq slots (plist-put slots :surname
                             (or surname ""))))
-    (unless (plist-get slots :suffix)
+    (unless (plist-member slots :suffix)
       (setq slots (plist-put slots :suffix suffix)))
     (cl-call-next-method class str slots)))
 

Reply via email to