How can I make BBDB recognize "compound" real names like

Jane von Arx
Peter de Vries 

and split them into firstnames "Jane" and "Peter" and lastnames "von
Arx" and "de Vries"?

Is there any functionality already implemented in current version of
BBDB?

If not, I propose the following patch for file bbdb.el retrieved from
the current CVS version.

cd bbdb/bbdb/lisp/
diff -c bbdb/bbdb/lisp/bbdb.el bbdb/bbdb/lisp/bbdb-a.el
*** bbdb/bbdb/lisp/bbdb.el      2003-10-26 11:43:02.000000000 +0100
--- bbdb/bbdb/lisp/bbdb-a.el    2004-01-10 19:02:54.345595000 +0100
***************
*** 360,365 ****
--- 360,372 ----
               (set symb val)
             (error "%s must contain digits only." symb))))
  
+ (defcustom bbdb-lastname-prefixes
+  '("von" "Von" "de" "De")
+   "*List of lastname prefixes recognized in name fields. Used to
+ enhance dividing name strings into firstname and lastname parts."
+   :group 'bbdb-record-creation
+   :type '(repeat string))
+ 
  (defcustom bbdb-default-domain nil
    "*The default domain to append when prompting for a new net address.
  If the address entered does not contain [EMAIL PROTECTED]', [EMAIL PROTECTED]'
***************
*** 3020,3026 ****
      (if gubbish
          (setq gubbish (substring str gubbish)
                str (substring string 0 (match-beginning 0))))
!     (if (string-match " +\\(\\([^ ]+ *- *\\)?[^ ]+\\)\\'" str)
          (list (substring str 0 (match-beginning 0))
                (concat
                 (substring str (match-beginning 1))
--- 3027,3041 ----
      (if gubbish
          (setq gubbish (substring str gubbish)
                str (substring string 0 (match-beginning 0))))
!     (if (string-match
!        (concat " +\\("
!                ;; start recognize some prefixes to lastnames
!                (if bbdb-lastname-prefixes
!                    (concat "\\("
!                            (regexp-opt bbdb-lastname-prefixes t)
!                            "[ ]+\\)?"))
!                ;; end recognize some prefixes to lastnames
!                "\\([^ ]+ *- *\\)?[^ ]+\\)\\'") str)
          (list (substring str 0 (match-beginning 0))
                (concat
                 (substring str (match-beginning 1))

Diff finished at Sat Jan 10 19:03:04

I am not shure about the list of other useful lastname
prefixes. "[vV]on" and "[dD]e" are safe (common prefix for lastnames,
and not used as firstnames) in my country (Switzerland).

"[dD]ella" "[dD]egli" "[dD]i" might be reasonable defaults for italian
names, "[dD]u" "[dD]e [lL]a" "[dD]es" for french names (but Des might
be a firstname in english?), "[vV]an" for dutch names, "[dD]o"
"[dD][oa]s" "[dD]allas" (dangeorous, but is that really italian,
spanish or protugues?) for spanish and protugues names, and "[mM]c"
"[mM]ac" for scottish names? Please help!

Thanks, Adrian.



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to