emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Re: Completing with anything


From: Eric Abrahamsen
Subject: [O] Re: Completing with anything
Date: Tue, 22 Mar 2011 23:02:33 +0800
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux)

Eric S Fraga <address@hidden> writes:

> Eric Abrahamsen <address@hidden> writes:
>
> [...]
>
>> This is what I've been using to insert other people's contact
>> information into emails. Probably no good for general use, but maybe
>> will provide food for thought.
>>
>> #+BEGIN_SRC emacs-lisp
>> (defun my-cite-contact (name)
>>   (interactive "sName (regexp): ")
>>   (let ((rec)
>>      (records (bbdb-search (bbdb-records) name name name nil nil)))
>>     (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))))))
>>     (insert (bbdb-dwim-net-address rec))))
>> #+END_SRC
>
> This looks quite nice; I have been missing the possibility of a regex
> search for mail addresses and the combination with ido is quite
> appealing.
>
> How do you invoke it?  I am currently struggling with the interactions
> between .mailrc (emacs mail aliases, expanding as abbrevs) and bbdb
> (expanding with TAB).  This is partly why I haven't even considered
> using org-contacts yet...
>
> As always, with Emacs, too many choices, too little time!  ;-)

I only ever invoke it through M-x, as I only ever use it to paste other
people's contact details into an email (something I find myself doing
surprisingly often).

The trick was definitely figuring out at what "level" to let ido do its
thing. The key was that bbdb came with both its own generic search
function, and its own formatting function—ido is just the glue between,
if necessary.

I don't really like the fact that you first produce a collection of
records, then pick *the name* of one record and essentially re-search
all the records for that particular name, but I couldn't figure out a
way to have ido select from among *representations* of actual records,
and then return the record directly. I think that's where ido will trip
you up: it's only made to select from strings.

E




reply via email to

[Prev in Thread] Current Thread [Next in Thread]