all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Getting user defined field from bbdb
@ 2010-07-27  6:24 Cecil Westerhof
  2010-07-27  7:29 ` Cecil Westerhof
  0 siblings, 1 reply; 2+ messages in thread
From: Cecil Westerhof @ 2010-07-27  6:24 UTC (permalink / raw)
  To: help-gnu-emacs

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)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Getting user defined field from bbdb
  2010-07-27  6:24 Getting user defined field from bbdb Cecil Westerhof
@ 2010-07-27  7:29 ` Cecil Westerhof
  0 siblings, 0 replies; 2+ messages in thread
From: Cecil Westerhof @ 2010-07-27  7:29 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-27  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27  6:24 Getting user defined field from bbdb Cecil Westerhof
2010-07-27  7:29 ` Cecil Westerhof

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.