Robert Widhopf-Fenk <[EMAIL PROTECTED]> writes: > On Friday, December 1, 2006 at 17:18:00, Thomas Gerds wrote: >> >> Adrian Aichner <[EMAIL PROTECTED]> writes: >> >> > Thomas Gerds <[EMAIL PROTECTED]> writes: >> > >> >> I would like that `bbdb-complete-name' completes also by last >> >> names. googling the topic suggested that one could add the last >> >> name of each entry to the AKA field. however, the following does >> >> not seem to work: >> > >> > Thomas, have you read the documentation of variable >> > bbdb-completion-type >> > and tried to change completion behavior this way? >> >> yes! the problem is the following: I want to write an email whose >> bbdb name is `Adrian Aichner' however I forgot the first name and >> start writing `Aic' then press tab (which finally calls >> bbdb-complete-name) since the full-name is `Adrian Aichner' the >> string `Aic' is not found. >> >> I see two possible solutions: >> >> 1. modify the function bbdb-complete-name such that the hashtable >> which currently is obtained by calling bbdb-hashtable is also >> includes the lastnames. > > You got the idea, but it is not `bbdb-complete-name' which > must/should be modified, it is full of trap and when ever > one tries to modify/fix it bugs are likely to slip in ... > > `bbdb-hash-record' must be modified, e.g. > > Index: bbdb.el > =================================================================== > RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb.el,v > retrieving revision 1.230 > diff -u -r1.230 bbdb.el > --- bbdb.el 9 Oct 2006 22:57:28 -0000 1.230 > +++ bbdb.el 15 Dec 2006 18:32:59 -0000 > @@ -2147,11 +2147,14 @@ > "Insert the record in the appropriate hashtables. This must be > called > while the .bbdb buffer is selected." > (let ((name (bbdb-record-name-1 record)) ; faster version > + (lastname (bbdb-record-lastname record)) > (company (bbdb-record-company record)) > (aka (bbdb-record-aka record)) > (net (bbdb-record-net record))) > (if (> (length name) 0) > (bbdb-puthash (downcase name) record bbdb-hashtable)) > + (if (> (length lastname) 0) > + (bbdb-puthash (downcase lastname) record bbdb-hashtable)) > (if (> (length company) 0) > (bbdb-puthash (downcase company) record bbdb-hashtable)) > (while aka > hi robert,
thanks very much! however, it did not work without the following modification of the function bbdb-complete-name: *************** *** 2418,2423 **** --- 2418,2432 ---- (length pattern)))) (setq match-recs (cons (car recs) match-recs) matched t))) + + ;; Did we match on lastname? + (let ((b-r-name (or (bbdb-record-lastname (car recs)) ""))) + (if (string= pattern + (substring (downcase b-r-name) 0 + (min (length b-r-name) + (length pattern)))) + (setq match-recs (cons (car recs) match-recs) + matched t))) ;; Did we match on aka? (when (not matched) I hope that this is not producing (m)any bugs ... best, tomy > Bye Robert > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > bbdb-info@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bbdb-info > BBDB Home Page: http://bbdb.sourceforge.net/ -- ><(((*> ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/