Roland Winkler <wink...@gnu.org> writes:

> On Sun Jul 31 2011 Johnny wrote:
>> I have started using aliases in bbdb and wonder if there is any setup to
>> autocomplete on defined aliases in the headers? Say, I have an alias
>> named "listofmembers" and want to mail them. I add this mail-alias field
>> to all relevant contacts, then in the "To" header type the full alias
>> "listofmembers" followed by TAB, this fills in the "To" header with the
>> group members email as expected. However, I would like to enable TAB
>> completion on alias names, e.g. if I type "lis" and TAB this should
>> ideally fill in the rest. Is this possible to achieve?
>
> This has (almost) nothing to do with BBDB. The mailabbrev package is
> doing this (both when you define aliases via a .mailrc file or via
> BBDB).
>
> You can use mail-abbrev-complete-alias from that package (I think,
> usually bound to M-Tab). If you also want to use bbdb-complete-mail
> things get a bit more complicated, as you need to specify some order
> for completion (whether mail-abbrev-complete-alias or
> bbdb-complete-mail should try first). Try something like
>
> (defun my-bbdb-complete-mail ()
>   (interactive)
>   (or (mail-abbrev-complete-alias)
>       (bbdb-complete-mail)))
>
This got me on the right track in learning about abbrevs, thanks! I
could get this working by binding in .gnus.el as: 

(setq message-setup-hook
      '(lambda ()
         (define-key message-mode-map "\M-\t" 'my-bbdb-complete-mail)))

This will of course only complete on the first match, i.e. if there is
an alias starting with 'lis', any bbdb record starting with 'lis' will
not be displayed. However, pure TAB completion works on bbdb records
only (Is this default bbdb or have I put something in my init to change,
I am not sure? Note to self: Have to clean these out someday).

Thus, I ended up just binding M-TAB to mail-abbrev-complete-alias. If I
want to complete on a name, I use *TAB*, if an alias just *M-TAB*. It
might be nice to make aliases and names all appear by the same
completion (like cycling), but this seems like overkill at the moment.

>> Second question, is there a clever way to list all mail aliases in BBDB,
>> and subsequently list all members of o select mail alias?
>
> How about bbdb-search-notes (bound to S N)?  If you want to list just
> the aliases, but not the records using them, you might have to write
> your own code.
Yes, this is exactly what I was looking for! I now can use this to get
my desired records (i.e. aliases) in the BBDB buffer, then return to my
Message buffer and do bbdb-yank-addresses to do the same as above, in a
different way!

Thanks for your accurate pointers Roland, right on target!

-- 
Johnny

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to