On Monday, February 19, 2007 at 09:54:33, Len Trigg wrote:
> Robert Widhopf-Fenk wrote:
> > In CVS bbdb-quiet-about-name-mismatches can be a function or
> > sexp now in order to tweak handling of name mismatches.
> > 
> > This is not as mighty as modifying bbdb-readonly-p would be,
> > but it is meant for what Len originally wanted.
> 
> Works a treat.  My bbdb-quiet-about-name-mismatches function is:
> 
> (defun my-bbdb-quiet-about-name-mismatches (record name)
>   "Tells BBDB whether to accept name updates for a record.  Looks
> to see if the record has a field called readonly."
>   (and record
>        (listp (bbdb-record-raw-notes record))
>        (cdr (assq 'readonly (bbdb-record-raw-notes record)))))

Are you paranoid, or are there any bugs I missed ? ;-)

There must be a record, otherwise there would not be a name
miss match.  Also bbdb-record-raw-notes will always return a
list, also nil is a list, so assq and cdr will not fail.

Your code should give you an error when a record has a
"readonly" field as you are returning a string which is
neither t nor a number.  BTW (if "" t) will return t,
i.e. also the empty string is true!

If you want to check the content of the field you have to
call a string comparison function ...

So a bit shorter is:

(setq bbdb-quiet-about-name-mismatches
  '(if (assq 'readonly (bbdb-record-raw-notes record)) t))

In CVS is now also code handling and doing this 

(setq bbdb-quiet-about-name-mismatches
  '(assq 'readonly (bbdb-record-raw-notes record)))

  
Sleep well,
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/

Reply via email to