From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.emacs.help Subject: Re: Getting user defined field from bbdb Date: Tue, 27 Jul 2010 09:29:07 +0200 Organization: Decebal Computing Message-ID: <87wrsh8jss.fsf@decebal.nl> References: <8739v5a1cc.fsf@decebal.nl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291853560 19900 80.91.229.12 (9 Dec 2010 00:12:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 00:12:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 01:12:36 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQU7g-00068n-76 for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 01:12:36 +0100 Original-Received: from localhost ([127.0.0.1]:56243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQTc0-0008JY-IJ for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 18:39:52 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:KWHKokctNCyav7B7gUWJB2ofTYQ= Original-Lines: 32 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: 1280215746 news.xs4all.nl 22935 decebal/[::ffff:84.53.123.169]:12805 Original-X-Complaints-To: abuse@xs4all.nl Original-Xref: usenet.stanford.edu gnu.emacs.help:180096 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76274 Archived-At: 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