From a596c893a4c063111a3f706ecab59c99cda7628e Mon Sep 17 00:00:00 2001 From: Feng Shu Date: Sat, 30 May 2015 08:33:40 +0800 Subject: [PATCH] Properly deal with whitespace between given-name and family-name --- bbdb-vcard.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bbdb-vcard.el b/bbdb-vcard.el index c5ef3fb..bfdb7fb 100644 --- a/bbdb-vcard.el +++ b/bbdb-vcard.el @@ -591,9 +591,18 @@ Extend existing BBDB records where possible." (name-to-search-for (when raw-name (if (stringp raw-name) raw-name - (concat (nth 1 raw-name) ; given name - " .*" - (nth 0 raw-name))))) ; family name + (let* ((given-name (nth 1 raw-name)) + (family-name (nth 0 raw-name)) + (separator + (if (or (not given-name) ; if given-name or family-name + (not family-name) ; is `nil', whitespace is needless. + ;; No whitespace needed between + ;; given-name and family-name for CJK users. + (string-match-p "\\cc" (or given-name "")) + (string-match-p "\\cc" (or family-name ""))) + ".*" + " .*"))) + (concat given-name separator family-name))))) (vcard-nicknames (bbdb-vcard-flatten (bbdb-vcard-search scard "NICKNAME" "content"))) ;; Organization suitable for storing in BBDB: