Eric Abrahamsen <e...@ericabrahamsen.net> writes: > For a while I've had a function for creating textual citations of my > BBDB contacts, that relied on `bbdb-dwim-mail'. I expanded that to make > use of org's link syntax, so that you can insert a BBDB link on the > spot, without having to first visit your *BBDB* buffer and create a link > there. I find this pretty helpful.
Me too! :) > If anyone can think of more formatting possibilities, "formats" could be > broken out into a variable. > > Incidentally, I'm using `ido-everywhere', and would like to write this > function so that it didn't _rely_ on ido, but made use of ido when > `ido-everywhere' was true. Ie, I'd like to replace the > `ido-completing-read' calls with something more generic that still made > use of ido when it was turned on. Any suggestions? This works for me: (defun cite-bbdb-contact (name) (interactive "sName (regexp): ") (let ((read (if (fboundp 'ido-completing-read) 'ido-completing-read 'completing-read)) (rec) (records (bbdb-search (bbdb-records) name name name nil nil)) (formats '(("text" . bbdb-dwim-mail) ("orglink" . (lambda (x) (let ((name (bbdb-record-name x))) (org-make-link-string (concat "bbdb:" name) name))))))) (if (= (length records) 1) (setq rec (car records)) (if (zerop (length records)) (error "No matching records") (setq rec (let ((int-name (funcall read "Pick one: " (mapcar 'bbdb-record-name records)))) (car (bbdb-search (bbdb-records) int-name)))))) (let ((func (cdr (assoc (funcall read "Format: " (mapcar #'car formats)) formats)))) (insert (funcall func rec))))) Note: I have no org-make-link, so I used org-make-link-string instead. -- Kevin Brubeck Unhammer GPG: 0x766AC60C
pgpNwjK5LGL37.pgp
Description: PGP signature
------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/