all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Cecil Westerhof <Cecil@decebal.nl>
To: help-gnu-emacs@gnu.org
Subject: Re: Getting user defined field from bbdb
Date: Tue, 27 Jul 2010 09:29:07 +0200	[thread overview]
Message-ID: <87wrsh8jss.fsf@decebal.nl> (raw)
In-Reply-To: 8739v5a1cc.fsf@decebal.nl

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


      reply	other threads:[~2010-07-27  7:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27  6:24 Getting user defined field from bbdb Cecil Westerhof
2010-07-27  7:29 ` Cecil Westerhof [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wrsh8jss.fsf@decebal.nl \
    --to=cecil@decebal.nl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.