From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: for your amusement Date: Thu, 02 Aug 2012 17:41:39 +0800 Message-ID: <87ipd1d418.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bbdb-info-bounces@lists.sourceforge.net To: bbdb-info@lists.sourceforge.net Cc: emacs-orgmode@gnu.org List-Id: emacs-orgmode.gnu.org 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. 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? Eric --8<---------------cut here---------------start------------->8--- (defun cite-bbdb-contact (name) (interactive "sName (regexp): ") (let ((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))) (format "[[%s][%s]]" (org-make-link "bbdb:" name) name))))))) (if (= (length records) 1) (setq rec (car records)) (if (zerop (length records)) (error "No matching records") (setq rec (let ((int-name (ido-completing-read "Pick one: " (mapcar 'bbdb-record-name records)))) (car (bbdb-search (bbdb-records) int-name)))))) (let ((func (cdr (assoc (ido-completing-read "Format: " (mapcar #'car formats)) formats)))) (insert (funcall func rec))))) --8<---------------cut here---------------end--------------->8--- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ bbdb-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/