More Emacs coolness: List of contacts

| bbdb, emacs, planner

This bit of Emacs Lisp code produces a Planner-ready list of the contacts displayed in the BBDB window.

(defun sacha/planner-bbdb-annotation-from-bbdb (&optional record)
  "If called from a bbdb buffer, return an annotation.
Suitable for use in `planner-annotation-functions'."
  (when (or record (eq major-mode 'bbdb-mode))
    (setq record (if record (car record) (bbdb-current-record)))
    (or (bbdb-record-getprop record 'plan)
        ;; From a BBDB entry with a plan page; use that. Yay!
        (planner-make-link
         (concat "bbdb://"
                 (planner-replace-regexp-in-string
                    " " "." (bbdb-record-name record)))
         (bbdb-record-name record)))))
(defalias 'planner-bbdb-annotation-from-bbdb 'sacha/planner-bbdb-annotation-from-bbdb)

(defun sacha/yank-planner-bbdb-list ()
  "Copy the list of people displayed in the buffer."
  (interactive)
  (kill-new
   (mapconcat 'sacha/planner-bbdb-annotation-from-bbdb
              bbdb-records
              ", "))
        (sacha/planner-bbdb-annotation-from-bbdb rec))

It allows me to say, for example, that I met 23 people yesterday:
Bruce, Daniel Charles, Shane D'Costa, Emily, Greg A. Fitz, Clara Fong, Jay Goldman, Harvey, Kai Fai Ho, Iris, KC, Charles McCulloch, Jamie McQuay, Joshua Meles, Naomi, Helen Overland, W- Penney, Simon Rowland, San, Colin Smillie, Solomon, Le Quan Truong, Perry Wong

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.