branch: externals/ebdb commit 3b92c7a772c995b677988e02da0257419f086866 Author: Eric Abrahamsen <e...@ericabrahamsen.net> Commit: Eric Abrahamsen <e...@ericabrahamsen.net>
Fix international parsing of phone numbers, bump to 0.6.5 * ebdb-i18n.el (ebdb-parse): Was using `replace-match' when it wasn't certain that `string-match' was getting called first. Not sure how I haven't run into this yet. --- ebdb-i18n.el | 9 +++++---- ebdb.el | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ebdb-i18n.el b/ebdb-i18n.el index 99a5a95..9a21da7 100644 --- a/ebdb-i18n.el +++ b/ebdb-i18n.el @@ -783,14 +783,15 @@ for their symbol representations." (cl-defmethod ebdb-parse :extra "i18n" ((class (subclass ebdb-field-phone)) (str string) &optional slots) - (let ((cc (or (plist-get slots :country-code) - (and (string-match "\\`(?\\+(?\\([0-9]\\{1,3\\}\\))?[ \t]+" str) - (string-to-number (match-string 1 str)))))) + (let* ((cc-reg "\\`(?\\+(?\\([0-9]\\{1,3\\}\\))?[ \t]+") + (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-match "" nil nil str 0) + (replace-regexp-in-string cc-reg "" str) cc (plist-put slots :country-code cc)) (cl-no-method nil))) (cl-call-next-method)))) diff --git a/ebdb.el b/ebdb.el index 329c023..64e4779 100644 --- a/ebdb.el +++ b/ebdb.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. -;; Version: 0.6.4 +;; Version: 0.6.5 ;; Package-Requires: ((emacs "25.1") (cl-lib "0.5") (seq "2.15")) ;; Maintainer: Eric Abrahamsen <e...@ericabrahamsen.net>