<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/assets/atom.xsl" type="text/xsl"?><feed
	xmlns="http://www.w3.org/2005/Atom"
	xmlns:thr="http://purl.org/syndication/thread/1.0"
	xml:lang="en-US"
	><title>Sacha Chua - category - bbdb</title>
	<subtitle>Emacs, sketches, and life</subtitle>
	<link rel="self" type="application/atom+xml" href="https://sachachua.com/blog/category/bbdb/feed/atom/index.xml" />
  <link rel="alternate" type="text/html" href="https://sachachua.com/blog/category/bbdb" />
  <id>https://sachachua.com/blog/category/bbdb/feed/atom/index.xml</id>
  <generator uri="https://11ty.dev">11ty</generator>
	<updated>2011-01-07T13:00:00Z</updated>
<entry>
		<title type="html">Emacs, BBDB, and getting your contacts on the Android or iPhone</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2011/01/emacs-bbdb-and-getting-your-contacts-on-the-android-or-iphone/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2011-01-08T07:00:30Z</updated>
    <published>2011-01-07T13:00:00Z</published>
    <category term="android" />
<category term="bbdb" />
<category term="emacs" />
		<id>https://sachachua.com/blog/?p=22034</id>
		<content type="html"><![CDATA[<p>Want your Emacs BBDB contacts on your Android or iPhone? </p>
<p> The easiest way I&#8217;ve found is to export your contacts to CSV, then import them into something like Google Contacts. You can export your BBDB contacts using <code>bbdb-to-outlook.el</code>, which is available in the BBDB package in the <code>bits/</code> directory. <a href="http://bbdb.cvs.sourceforge.net/viewvc/bbdb/bbdb/bits/bbdb-to-outlook.el">Download bbdb-to-outlook.el from Sourceforge</a>  if you can&#8217;t find it in your BBDB directory. To use: </p>
<ol>
<li> Load bbdb-to-outlook.el and use <code>M-x eval-buffer</code> to load the code. </li>
<li> Use <code>M-x bbdb</code> to open your BBDB records, and search for <code>.</code> to show all the records. Alternatively, search for a subset of your records. </li>
<li> Type <code>O</code> to run <code>bbdb-to-outlook</code> and choose the file. </li>
</ol>
<p> Tada! Step one done. Review the file and delete anything you don&#8217;t want to include. </p>
<p> To import the contacts into Google Contacts, go to Google Mail and click on Contacts. Click on <code>Import</code> and choose your file. After some time and some fiddling, you can get that synchronized onto your Android or iPhone. </p>
<p> I haven&#8217;t thought about syncing, but I&#8217;m trying to keep my BBDB as The Master File for Contacts anyway, as it&#8217;s so much more flexible than any other contact database I&#8217;ve tried. (Although gist.com is pretty cool and I do like the Android&#8217;s merging of photos, contact info, and updates&hellip;) </p>
<p> There was some work on <a href="http://www.emacswiki.org/emacs/BbdbExportImportSync">synchronizing BBDB with the Palm</a>, so that might be a possibility. </p>
<p> Enjoy! </p>
<p>You can <a href="https://sachachua.com/blog/2011/01/emacs-bbdb-and-getting-your-contacts-on-the-android-or-iphone/#comment">view 12 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2011%2F01%2Femacs-bbdb-and-getting-your-contacts-on-the-android-or-iphone%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry><entry>
		<title type="html">Emacs, Org, and BBDB: Hyperlinking names to blogs</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/12/emacs-org-and-bbdb-hyperlinking-names-to-blogs/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2008-12-19T07:48:44Z</updated>
    <published>2008-12-19T02:48:44Z</published>
    <category term="bbdb" />
<category term="emacs" />
<category term="org" />
		<id>https://sachachua.com/blog/?p=5461</id>
		<content type="html"><![CDATA[<p>Back when I used Planner for Emacs, I coded some shortcuts to make it easier to write about the people I met and the conversations I had. I used the hippie-expand module to complete names from my Big Brother Database addressbook, and I wrote a function that converted those names into links to people&#8217;s blogs or websites whenever I published my blog posts as HTML.</p>
<p>I switched to WordPress for my blog because I got tired of trying to figure out a way to enable comments without getting mired in spam-fighting. That meant I could explore other Emacs personal information managers like Org, which I turned into my main task manager. I often used the WordPress interface to write blog posts. I sometimes used Windows Live Writer to write posts about books (there&#8217;s a good book review plugin that makes this easy). I also sometimes used Emacs and Org to draft blog posts using Org&#8217;s friendlier markup, exporting snippets to HTML that I then pasted into my blog posts.</p>
<p>Reading the posts on <a href="http://planet.emacsen.org">Planet Emacsen</a> reminded me that my customized configuration was pretty darn sweet. That and the conversation notes I&#8217;ve been blogging lately encouraged me to dust off my configuration files and get them to work under Org. So here&#8217;s the code:</p>
<pre>
 (defun sacha/org-bbdb-get (path)
   "Return BBDB record for PATH."
   (car (bbdb-search (bbdb-records) path path path)))
 
 (defun sacha/org-bbdb-export (path desc format)
   "Create the export version of a BBDB link specified by PATH or DESC.
 If exporting to HTML, it will be linked to the person's blog,
 www, or web address. If exporting to LaTeX FORMAT the link will be
 italicised. In all other cases, it is left unchanged."
     (cond
      ((eq format 'html)
       (let* ((record
             (sacha/org-bbdb-get path))
            url)
       (setq url (and record
                      (or (bbdb-record-getprop record 'blog)
                          (bbdb-record-getprop record 'www)
                          (bbdb-record-getprop record 'web))))
       (if url
           (format "&lt;a href=\"%s\"&gt;%s&lt;/a&gt;"
                   url (or desc path))
         (format "&lt;em&gt;%s&lt;/em&gt;"
                 (or desc path)))))
      ((eq format 'latex) (format "\\textit{%s}" (or desc path)))
      (t (or desc path))))
 
 (defadvice org-bbdb-export (around sacha activate)
   "Override org-bbdb-export."
   (setq ad-return-value (sacha/org-bbdb-export path desc format)))
 
 ;;;_+ Hippie expansion for BBDB; map M-/ to hippie-expand for most fun
 (add-to-list 'hippie-expand-try-functions-list 'sacha/try-expand-bbdb-annotation)
 (defun sacha/try-expand-bbdb-annotation (old)
   "Expand from BBDB. If OLD is non-nil, cycle through other possibilities."
   (unless old
     ;; First time, so search through BBDB records for the name
     (he-init-string (he-dabbrev-beg) (point))
     (when (&gt; (length he-search-string) 0)
       (setq he-expand-list nil)
       (mapcar
        (lambda (item)
        (let ((name (bbdb-record-name item)))
          (when name
            (setq he-expand-list
                  (cons (org-make-link-string
                       (org-make-link "bbdb:" name)
                       name)
                        he-expand-list)))))
        (bbdb-search (bbdb-records)
                     he-search-string
                     he-search-string
                     he-search-string
                     nil nil))))
   (while (and he-expand-list
               (or (not (car he-expand-list))
                   (he-string-member (car he-expand-list) he-tried-table t)))
     (setq he-expand-list (cdr he-expand-list)))
   (if (null he-expand-list)
       (progn
         (if old (he-reset-string))
         nil)
     (progn
       (he-substitute-string (car he-expand-list) t)
       (setq he-expand-list (cdr he-expand-list))
       t)))
</pre>
<p>If you&#8217;ve got Org and BBDB, drop this into your ~/.emacs and fiddle with it. =)</p>
<p>You can <a href="https://sachachua.com/blog/2008/12/emacs-org-and-bbdb-hyperlinking-names-to-blogs/#comment">view 1 comment</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F12%2Femacs-org-and-bbdb-hyperlinking-names-to-blogs%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry><entry>
		<title type="html">Emacs: Someone who&#8217;s even geekier about BBDB!</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/07/emacs-someone-whos-even-geekier-about-bbdb/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2008-07-26T05:40:41Z</updated>
    <published>2008-07-26T01:40:24Z</published>
    <category term="bbdb" />
<category term="emacs" />
		<id>https://sachachua.com/blog/?p=4985</id>
		<content type="html"><![CDATA[<p>Remember all those tweaks I posted for <a href="https://sachachua.com/blog/category/bbdb">working with contacts using Emacs&#8217; Big Brother Database</a>? John Sturdy has even cooler stuff. Check out his <a href="http://www.cb1.com/~john/computing/emacs/lisp/my-extensions-to-packages/bbdb/index.html">BBDB extensions</a>. His <a href="http://www.cb1.com/~john/computing/emacs/lisp/my-extensions-to-packages/bbdb/bbdb-export-lists.el">bbdb-export-lists.el</a> can divide people into different phone and address lists, and his <a href="http://www.cb1.com/~john/computing/emacs/lisp/my-extensions-to-packages/bbdb/bbdb-human-names.el">bbdb-human-names.el</a> will even try to address people properly. Clearly, I don&#8217;t talk to enough Reverend Doctors to require code like this. (And shouldn&#8217;t there be &#8220;Right Honorables&#8221; and &#8220;His Grace&#8221;s in there, too? ;) )</p>
<p>You can <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F07%2Femacs-someone-whos-even-geekier-about-bbdb%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry><entry>
		<title type="html">Emacs: BBDB: Modifying the record creation process</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/07/emacs-bbdb-modifying-the-record-creation-process/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2008-07-20T19:27:13Z</updated>
    <published>2008-07-20T15:26:53Z</published>
    <category term="bbdb" />
<category term="emacs" />
		<id>https://sachachua.com/blog/?p=4968</id>
		<content type="html"><![CDATA[<p>You might want to add fields to the record creation process in M-x bbdb-create. In addition to asking for name, company, e-mail address, addresses, phone numbers, and notes, you may want to make sure you remember to put in birthdates or other information.  If you want to prompt for custom fields after the regular BBDB creation form, modify this simple example to suit your needs:</p>
<pre>
(defadvice bbdb-read-new-record (after wicked activate)
  "Prompt for the birthdate as well."
  (bbdb-record-putprop ad-return-value 'birthdate
		       (bbdb-read-string "Birthdate (YYYY.MM.DD): ")))
</pre>
<p>Thanks to Kaleb Yilma for the question!</p>
<p>You can <a href="https://sachachua.com/blog/2008/07/emacs-bbdb-modifying-the-record-creation-process/#comment">view 2 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F07%2Femacs-bbdb-modifying-the-record-creation-process%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry><entry>
		<title type="html">Wicked Cool Emacs: BBDB: Import CSV and vCard Files</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/04/wicked-cool-emacs-bbdb-import-csv-and-vcard-files/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2008-04-13T02:19:49Z</updated>
    <published>2008-04-12T22:19:11Z</published>
    <category term="bbdb" />
<category term="emacs" />
<category term="wickedcoolemacs" />
		<id>https://sachachua.com/blog/?p=4834</id>
		<content type="html"><![CDATA[<p>If you have many contacts in another address book program, you can import them into BBDB. Two popular formats are comma-separated value files (CSV) and vCard files (VCF).</p>
<h3>Project XXX: Import a CSV File into BBDB</h3>
<p>To import a CSV file into BBDB, you will need csv.el from http://ulf.epplejasper.de/downloads/csv.el and lookout.el from http://ulf.epplejasper.de/downloads/lookout.el . Save both files to your ~/elisp directory. Make sure that your ~/elisp directory is in your load-path by adding the following line to your ~/.emacs:</p>
<pre>
(add-to-list 'load-path "~/elisp")
</pre>
<p>Export your contacts as an Outlook-style CSV file, then open the file in Emacs. After loading the following code, call M-x wicked/bbdb-import-csv-buffer to merge the CSV data into your address book. Emacs will try to update existing records based on the e-mail address or name provided, creating new records if necessary. After Emacs updates the records, the relevant records are displayed in the *BBDB* buffer. Here is the code to make that work:</p>
<p>ch6-bbdb-import-csv-buffer.el:</p>
<pre>
(require 'lookout)
(defconst wicked/lookout-bbdb-mapping-table-outlook
  '(("name" "Name")
    ("net" "E-mail Address")
    ("notes" "Notes")
    ("phones" "Mobile Phone"
     "Home Phone"
     "Home Phone 2"
     "Home Fax"
     "Business Phone"
     "Business Phone 2"
     "Business Fax"
     "Other Phone"
     "Other Fax")
    ("addr1" "Home Address")
    ("addr2" "Business Address")
    ("addr3" "Other Address")
    ("lastname" "Last Name")
    ("firstname" "First Name")
    ("job" "Job Title")
    ("company" "Company")
    ("otherfields" ""))
  "Field mappings for Outlook-type CSVs exported from Outlook, Gmail, LinkedIn, etc.")

(defun wicked/bbdb-import-csv-line (line)
  "Import LINE as a CSV, trying to merge it with existing records."
  (let* (record
	 (name  (lookout-bbdb-get-value "name" line))
	 (lastname (lookout-bbdb-get-value "lastname" line))
	 (firstname (lookout-bbdb-get-value "firstname" line))
	 (company   (lookout-bbdb-get-value "company" line))
         (job       (lookout-bbdb-get-value "job" line))
	 (net       (lookout-bbdb-get-value "net" line))
	 (addr1     (lookout-bbdb-get-value "addr1" line))
	 (addr2     (lookout-bbdb-get-value "addr2" line))
	 (addr3     (lookout-bbdb-get-value "addr3" line))
	 (phones    (lookout-bbdb-get-value "phones" line t)) ;; !
	 (notes     (lookout-bbdb-get-value "notes" line ))
         (j (concat job ", " company))
	 (otherfields (lookout-bbdb-get-value "otherfields" line t))
	 (addrs nil)
         name-search
	 (message ""))
    (if (string= company "") (setq company nil))
    (if (string= notes "") (setq notes nil))
    (if (string= name "") (setq name nil))
    (setq name-search (concat "^" (or name (concat firstname " " lastname))))
    (setq record (or (bbdb-search (bbdb-records) nil nil net)
		     (bbdb-search (bbdb-records) name-search)))
    (if record
	(progn
	  ;; Matching records found, update first matching record
	  (setq record (car record))
	  (let ((nets (bbdb-record-net record)))
	    (unless (member net nets)
	      ;; New e-mail address noticed, add to front of list
	      (add-to-list 'nets net)
	      (bbdb-record-set-net record nets)
	      (message "%s: New e-mail address noticed: %s"
		       (or name (concat firstname " " lastname)) net)))
	  ;; Check if job title and company have changed
	  (when (or job company)
	    (cond
	     ((string= (or (bbdb-record-company record) "") "")
	      (bbdb-record-set-company record j))
	     ((string= (bbdb-record-company record) j)
	      nil)
	     (t
	      (bbdb-record-set-notes
	       record
	       (concat "Noticed change from job title of "
		       (bbdb-record-company record)
		       "\n"
		       (bbdb-record-notes record)))
	      (message "%s: Noticed change from job title of %s to %s"
		       (or name (concat firstname " " lastname))
		       (bbdb-record-company record) j)
	      (bbdb-record-set-company record j)))))
      ;; No record found, create record
      (if (and addr1 (> (length addr1) 0))
	  (add-to-list 'addrs
		       (vector "Address 1" (list addr1) "" "" "" "")))
      (if (and addr2 (> (length addr2) 0))
	  (add-to-list 'addrs
		       (vector "Address 2" (list addr2) "" "" "" "")))
      (if (and addr3 (> (length addr3) 0))
	  (add-to-list 'addrs
		       (vector "Address 3" (list addr3) "" "" "" "")))
      (setq record (list
		    (wicked/lookout-bbdb-create-entry
		     (or name (concat firstname " " lastname))
		     (concat job ", " company)
		     net
		     addrs
		     phones
		     notes
		     otherfields))))
    record))
  
(defun wicked/lookout-bbdb-create-entry (name company net addrs phones notes
					      &amp;amp;optional otherfields)
  (when (or t (y-or-n-p (format "Add %s to bbdb? " name)))
    ;;(message "Adding record to bbdb: %s" name)
    (let ((record (bbdb-create-internal name company net addrs phones notes)))
      (unless record (error "Error creating bbdb record"))
      (mapcar (lambda (i)
		(let ((field (make-symbol (aref i 0)))
		      (value (aref i 1)))
		  (when (and value (not (string= "" value)))
		    (bbdb-insert-new-field record field value))))
	      otherfields)
      record)))

(defun wicked/bbdb-import-csv-buffer ()
  "Import this buffer."
  (interactive)
  (let ((lookout-bbdb-mapping-table
	 wicked/lookout-bbdb-mapping-table-outlook))
    (bbdb-display-records
     (mapcar
      'wicked/bbdb-import-csv-line
      (csv-parse-buffer t)))))
</pre>
<h3>Project xxx: Import a vCard File into BBDB</h3>
<p>To import a vCard file (VCF) into BBDB, you will need vcard.el from http://www.splode.com/~friedman/software/emacs-lisp/src/vcard.el and bbdb-vcard-import.el from http://www-pu.informatik.uni-tuebingen.de/users/crestani/downloads/bbdb-vcard-import.el . By default, these files allow you to import names and e-mail addresses from vCard files exported from various address book programs. Save vcard.el and bbdb-vcard-import.el to your ~/elisp directory and add the following lines to your ~/.emacs:</p>
<pre>
(add-to-list 'load-path "~/elisp")
(require 'bbdb-vcard-import)
</pre>
<p>Back up your ~/.bbdb file before calling M-x bbdb-vcard-import to import a file or M-x bbdb-vcard-import-buffer to import the current buffer. WARNING: If your vCard file includes fields with multiline values, you may get silent errors. Verify your import by browsing through the displayed entries. If some of them have been misread, revert to your backup ~/.bbdb by closing Emacs and copying your backup over the ~/.bbdb file. To fix the multi-line error, include the following lines in your ~/.emacs:</p>
<pre>
(defun wicked/vcard-parse-region (beg end &amp;amp;optional filter)
  "Parse the raw vcard data in region, and return an alist representing data.
This function is just like `vcard-parse-string' except that it operates on
a region of the current buffer rather than taking a string as an argument.

Note: this function modifies the buffer!"
  (or filter
      (setq filter 'vcard-standard-filter))
  (let ((case-fold-search t)
        (vcard-data nil)
        (pos (make-marker))
        (newpos (make-marker))
        properties value)
    (save-restriction
      (narrow-to-region beg end)
      (save-match-data
        ;; Unfold folded lines and delete naked carriage returns
        (goto-char (point-min))
        (while (re-search-forward "\r$\\|\n[ \t]" nil t)
          (goto-char (match-beginning 0))
          (delete-char 1))
        (goto-char (point-min))
        (re-search-forward "^begin:[ \t]*vcard[ \t]*\n")
        (set-marker pos (point))
        (while (and (not (looking-at "^end[ \t]*:[ \t]*vcard[ \t]*$"))
                    (re-search-forward ":[ \t]*" nil t))
          (set-marker newpos (match-end 0))
          (setq properties
                (vcard-parse-region-properties pos (match-beginning 0)))
          (set-marker pos (marker-position newpos))
          (re-search-forward "\n[-A-Z0-9;=]+:")   ;; change to deal with multiline
          (set-marker newpos (1+ (match-beginning 0))) ;; change to deal with multiline
          (setq value
                (vcard-parse-region-value properties pos (match-beginning 0)))
          (set-marker pos (marker-position newpos))
          (goto-char pos)
          (funcall filter properties value)
          (setq vcard-data (cons (cons properties value) vcard-data)))))
    (nreverse vcard-data)))
;; Replace vcard.el's definition
(fset 'vcard-parse-region 'wicked/vcard-parse-region)
</pre>
<p>Because address book programs don&#8217;t use standard labels for addresses and phone numbers, bbdb-vcard-import.el ignores those fields. For example, Gmail uses the generic field &#8220;Label&#8221; for address information and does not use separate fields for city, state, zip code, and country. While bbdb-snarf.el makes an attempt to extract addresses from plain text, it seems to be less trouble to export to the Outlook CSV format instead, or even to type the address in yourself. If you want to import addresses, see Project XXX: Import a CSV File into BBDB.</p>
<p>Here&#8217;s a partial workaround to enable you to import phone numbers. I tested this code with vCard files from Gmail and LinkedIn. To try it out, add the following modifications to your ~/.emacs:</p>
<pre>
(defun wicked/bbdb-vcard-merge (record)
  "Merge data from vcard interactively into bbdb."
  (let* ((name (bbdb-vcard-values record "fn"))
	 (company (bbdb-vcard-values record "org"))
	 (net (bbdb-vcard-get-emails record))
	 (addrs (bbdb-vcard-get-addresses record))
	 (phones (bbdb-vcard-get-phones record))
	 (categories (bbdb-vcard-values record "categories"))
	 (notes (and (not (string= "" categories))
		     (list (cons 'categories categories))))
	 ;; TODO: addrs are not yet imported.  To do this right,
	 ;; figure out a way to map the several labels to
	 ;; `bbdb-default-label-list'.  Note, some phone number
	 ;; conversion may break the format of numbers.
	 (bbdb-north-american-phone-numbers-p nil)
	 (new-record (bbdb-vcard-merge-interactively name
						     company
						     net
						     nil ;; Skip addresses
						     phones ;; Include phones
						     notes)))
    (setq bbdb-vcard-merged-records (append bbdb-vcard-merged-records 
					    (list new-record)))))
;; Replace bbdb-vcard-import.el's definition
(fset 'bbdb-vcard-merge 'wicked/bbdb-vcard-merge)
</pre>
<p>Evaluate this code or restart Emacs, then call M-x bbdb-import-vcard again, which should merge phone numbers into your BBDB records.</p>
<p>You can <a href="https://sachachua.com/blog/2008/04/wicked-cool-emacs-bbdb-import-csv-and-vcard-files/#comment">view 5 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F04%2Fwicked-cool-emacs-bbdb-import-csv-and-vcard-files%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry><entry>
		<title type="html">Wicked Cool Emacs: BBDB: Work with Records</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/04/wicked-cool-emacs-bbdb-work-with-records-2/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2008-04-12T23:23:10Z</updated>
    <published>2008-04-12T19:21:58Z</published>
    <category term="bbdb" />
<category term="emacs" />
<category term="wickedcoolemacs" />
		<id>https://sachachua.com/blog/?p=4833</id>
		<content type="html"><![CDATA[<h3>Creating Records</h3>
<p>
Creating a record in BBDB is not like creating a record in graphical address book programs. You will be prompted for each field through the minibuffer, one field at a time. Don&#8217;t worry about making mistakes while entering data, as you can always edit the records afterwards.
</p>
<p>
To create a record, use the command M-x bbdb-create. Here are the prompts you&#8217;ll encounter:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<col align="left">
<col align="left">
<col align="left">
<tbody>
<tr>
<td>Prompt</td>
<td>Notes</td>
<td>Example</td>
</tr>
<tr>
<td>Name</td>
<td>Full name</td>
<td>John Doe</td>
</tr>
<tr>
<td>Company</td>
<td>Company or organization</td>
<td>ACME</td>
</tr>
<tr>
<td>Network Address</td>
<td>E-mail address (comma-separated list)</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Address Description</td>
<td>Short identifier for address (Home, Office, etc.) &#8211; tab completion available. Leave blank if you have no address information, or if you are done.</td>
<td>Home</td>
</tr>
<tr>
<td>Street, line 1</td>
<td>Street address, line 1 (not including city, state, postal code or country)</td>
<td>1 Acme Road</td>
</tr>
<tr>
<td>Street, line &#8230;</td>
<td>Street address, more lines &#8211; press RET to indicate the end of the street address</td>
<td></td>
</tr>
<tr>
<td>City</td>
<td></td>
<td>Acme City</td>
</tr>
<tr>
<td>State</td>
<td>Abbreviations are okay. Consistency helps.</td>
<td>AC</td>
</tr>
<tr>
<td>Country</td>
<td></td>
<td>Acme Country</td>
</tr>
<tr>
<td>Phone Location</td>
<td>Short identifier for phone number (Home, Office, etc.) &#8211; tab completion available. Leave blank if you have no phone information, or if you are done.</td>
<td>Home</td>
</tr>
<tr>
<td>Phone</td>
<td>Phone number. I tend to specify the full number, using spaces to break it into readable chunks.</td>
<td>+1 111 111 1111 x1111</td>
</tr>
<tr>
<td>Additional Comments</td>
<td>Notes about the person, such as interests, how you met, and so on</td>
<td>Likes rockets</td>
</tr>
</tbody>
</table>
<p>
Press RET to skip any fields for which you don&#8217;t have information. To<br>
cancel the entry process, type <kbd>C-g</kbd> (keyboard-quit).
</p>
<p>
After you create the record, Emacs will display the record in another<br>
window. You can then switch to the record and edit it. See Project XXX: Edit a BBDB record.
</p>
<h3>
Searching Records<br>
</h3>
<p>
To search for a specific record, type M-x bbdb, or press <kbd>b</kbd><br>
(bbdb) while in the <b>BBDB</b> buffer. This prompts for a regular<br>
expression and searches the name, company, network address, and notes<br>
fields of all the records for a match against the regular expression<br>
supplied. M-x bbdb-name, M-x bbdb-company, M-x bbdb-net, M-x<br>
bbdb-notes, and M-x bbdb-phones search the corresponding fields only.
</p>
<h3>
Updating Records<br>
</h3>
<p>
After creating or searching for a record, you can switch to the <b>BBDB</b><br>
window to edit it. Press <kbd>C-o</kbd> (bbdb-insert-field) to insert<br>
custom fields. You can use tab completion on existing field names, and<br>
you can also define your own fields by typing any field name. For<br>
example, you may want to store people&#8217;s job titles in a field called<br>
&#8220;job&#8221;.
</p>
<p>
To edit the value of a field, move your cursor to the field and press<br>
<kbd>e</kbd> (bbdb-edit-current-field) to change the value. To delete<br>
a field, move your cursor to the field and press <kbd>C-k</kbd><br>
(bbdb-delete-current-field-or-record).
</p>
<h3>
Deleting Records<br>
</h3>
<p>
To delete an entire record, move the text cursor to the name and press <kbd>C-k</kbd> (bbdb-delete-current-field-or-record).  You will be prompted for confirmation. Be careful! If you mistakenly delete a record, there&#8217;s no easy way to get it back. Fortunately, BBDB stores its data in a plain text file (~/.bbdb). Back up that file regularly and you&#8217;ll be able to recover from mistakes. You can also set up automatic file backups in Emacs (see Project XXX: Make Automatic Backups).
</p>
<p>
Now you know how to work with individual records. How can you import your address book information from other programs?</p>
<p>You can <a href="https://sachachua.com/blog/2008/04/wicked-cool-emacs-bbdb-work-with-records-2/#comment">view 2 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F04%2Fwicked-cool-emacs-bbdb-work-with-records-2%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry><entry>
		<title type="html">Wicked Cool Emacs: BBDB: Set up BBDB</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/04/wicked-cool-emacs-bbdb-set-up-bbdb/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2008-04-12T23:11:20Z</updated>
    <published>2008-04-12T19:10:14Z</published>
    <category term="bbdb" />
<category term="emacs" />
<category term="wickedcoolemacs" />
		<id>https://sachachua.com/blog/?p=4831</id>
		<content type="html"><![CDATA[<p>The main address book and contact management module for Emacs is the Insidious Big Brother Database (BBDB), which can be integrated into several mail clients and other modules within Emacs. If you use BBDB to keep track of contact information, you&#8217;ll be able to look up phone numbers or add notes to people&#8217;s records from your Emacs-based mail. Even if you don&#8217;t do e-mail within Emacs, you&#8217;ll find that BBDB&#8217;s customizability makes it surprisingly powerful.</p>
<p>In this project, you will learn how to set up BBDB as a basic address book.  The BBDB homepage is at <i>http://bbdb.sourceforge.net/</i>.  The development version fixes a number of bugs, so I recommend you try it instead of the stable version. However, if you are on Microsoft Windows or you do not have development tools handy, you might find the stable version easier to install. As of this writing, the stable version (2.35) can be downloaded from http://bbdb.sourceforge.net/bbdb-2.35.tar.gz . Download and unpack it to ~/elisp/bbdb-2.35, and save the pre-built bbdb-autoloads.el from http://bbdb.sourceforge.net/bbdb-autoloads.el into ~/elisp/bbdb-2.35/lisp .</p>
<p>To check out the development version, change to your <i>~/elisp</i> directory and type in the following lines at the command prompt:</p>
<pre>
cvs -d :pserver:anonymous@bbdb.cvs.sourceforge.net:/cvsroot/bbdb login
cvs -d :pserver:anonymous@bbdb.cvs.sourceforge.net:/cvsroot/bbdb checkout bbdb
</pre>
<p>You should now have a directory called <i>~/elisp/bbdb</i>. Change to that directory and run the following commands:</p>
<pre>
autoconf
./configure
make autoloads
make all
</pre>
<p>After installing either the stable or development version of BBDB, include it in your load-path by adding the appropriate line to your <i>~/.emacs</i>:</p>
<pre>
(add-to-list 'load-path "~/elisp/bbdb-2.35/lisp")    ;; (1)
(add-to-list 'load-path "~/elisp/bbdb/lisp")         ;; (2)

(require 'bbdb) ;; (3)
(bbdb-initialize 'gnus 'message)   ;; (4)
(setq bbdb-north-american-phone-numbers-p nil)   ;; (5)
</pre>
<p>Use either <i>~/elisp/bbdb-2.35/lisp</i>(1) or <i>~/elisp/bbdb/lisp</i>(2) depending on the location of the installed BBDB Lisp files. Then load BBDB(3) and configure it for the Gnus mail client and the Message mode used to compose mail(4). It&#8217;s also a good idea to configure BBDB to accept any kind of phone number(5), not just North American numbers with a particular syntax.</p>
<p>After you evaluate this code or restart Emacs, BBDB should be part of your system. Next step: enter your address book!</p>
<p>You can <a href="https://sachachua.com/blog/2008/04/wicked-cool-emacs-bbdb-set-up-bbdb/#comment">view 2 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F04%2Fwicked-cool-emacs-bbdb-set-up-bbdb%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry>
</feed>