branch: externals/ebdb
commit fc813dd09e585541956c35f07ac0e21ac3715496
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
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
(ebdb-string-trim
(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)))