[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting user defined field from bbdb
From: |
Cecil Westerhof |
Subject: |
Re: Getting user defined field from bbdb |
Date: |
Wed, 08 Dec 2010 15:21:11 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Op dinsdag 27 jul 2010 08:24 CEST schreef Cecil Westerhof:
> I wrote a function to insert (parameter driven) certain fields from a
> bbdb record into the current buffer. But a bbdb cab have user defined
> fields. How can I get the value of those fields? (for example
> mailer)
I have something that works:
(progn
(setq field-to-use "mailer"
this-string "ERROR: field not found"
user-defined-fields (elt this-record 7))
(while user-defined-fields
(setq this-field (car user-defined-fields)
user-defined-fields (cdr user-defined-fields))
(when (string= field-to-use (car this-field))
(setq this-string (format "%s" (cdr this-field))
user-defined-fields nil)))
this-string)
The code expects that this-record is filled with the record from the
bbdb from which you want to extract info.
It is just a proof of concept, some things have to be done better. But
as far as I can see, this does what needs to be done. I am not yet
fluent at Emacs Lisp. So I was wondering if this code is good, or if
there are serious optimisations possible.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof