[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb fc813dd 193/350: Yet more fixes to proper name for

From: Eric Abrahamsen
Subject: [elpa] externals/ebdb fc813dd 193/350: Yet more fixes to proper name formatting
Date: Mon, 14 Aug 2017 11:46:35 -0400 (EDT)

branch: externals/ebdb
commit fc813dd09e585541956c35f07ac0e21ac3715496
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Yet more fixes to proper name formatting
    * ebdb.el (ebdb-name-fl): Pass the "full" flag to ebdb-name-given.
      (ebdb-string): By default return the full name.
      (ebdb-init-field): Hash against name both with and without full
      given names.
    Further fixes to problems revealed by 927c2ac.  A back-and-forth pass
    through ebdb-string --> ebdb-parse --> ebdb-string should always be
    idempotent.  That means use full given names everywhere by default,
    and only remove middle names for convenience.
    Now middle names are displayed by default in *EBDB* buffers.  We'll
    probably want a customization option for that.
 ebdb.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index f0f9f32..a5b4244 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -878,8 +878,8 @@ first one."
            (when prefix prefix)
            (when given-string (format ", %s" given-string)))))
-(cl-defmethod ebdb-name-fl ((name ebdb-field-name-complex) &optional _full)
-  (let ((given (ebdb-name-given name)))
+(cl-defmethod ebdb-name-fl ((name ebdb-field-name-complex) &optional full)
+  (let ((given (ebdb-name-given name full)))
     (with-slots (prefix surname suffix) name
        (concat (when given
@@ -896,13 +896,17 @@ first one."
   ;; produces the name you'll see in the *EBDB* buffer, so this is the
   ;; bit that should be most customizable, and most flexible.  This
   ;; value also gets stored in the cache.
-  (ebdb-name-fl name))
+  (ebdb-name-fl name t))
 (cl-defmethod ebdb-init-field ((name ebdb-field-name-complex) &optional record)
   (when record
-    (let ((lf (ebdb-name-lf name))
+    (let ((lf-full (ebdb-name-lf name t))
+         (fl-full (ebdb-name-fl name t))
          (fl (ebdb-name-fl name)))
-       (ebdb-puthash lf record)
+       (ebdb-puthash lf-full record)
+       (ebdb-puthash fl-full record)
+       ;; Also hash against "first last", as an alternate search
+       ;; strategy.
        (ebdb-puthash fl record)
        (object-add-to-list (ebdb-record-cache record) 'alt-names lf)
        (object-add-to-list (ebdb-record-cache record) 'alt-names fl)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]