Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 21: Advanced Gnus

Previous HourNext Hour

Sections in this Hour:

 

Using a Database with Gnus


When communicating with lots of people using email and news, it can often be either difficult to remember the email address of a person, or to remember who a person is, when you see a message from him. This can be solved by using a database with information about people.

BBDB (Insidious Big Brother Database) is such a database. It can work together with Gnus to let you search for an email address when filling out the To field, for example. It also pops up with the information from the database about a person when you load a message from him.

To make BBDB work together with Gnus, you need to insert the following lines into your .Gnus file:


(require 'bbdb) 
(bbdb-initialize) 
(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) 
(add-hook 'gnus-startup-hook 'bbdb-insinuate-message) 
(add-hook 'message-setup-hook 'bbdb-define-all-aliases) 
(sams-bind-alias-tabs-in-gnus) 

Inserting Entries into BBDB

The database is worthless as long as there is nothing in it, so I'll start out by showing how to insert entries into the database.

The easiest way to insert an entry for a person into BBDB is to press : (colon) in the Summary buffer when a message from him is the selected one. If the person is in the database already, nothing happens; otherwise, Emacs asks you if you want to insert him into the database.

Sometimes you might also want to add a note on the entry. That might be a comment on who this guy is. This can be done by pressing ; (semicolon). If the person is not in the database, he will first be inserted.

Whenever Gnus is about to show a message for a person in the database, a window with the BBDB entry is shown, as can be seen in Figure 21.5.

Figure 21.5
The BBDB window.

If you do not have a message from the person you want to insert into the database, you can press M-x and type bbdb-create. Emacs then asks you a number of questions about the person's name, net-address (email address), postal address, and phone number.

Editing an Entry

Editing the entry for a person is quiet easy. First you have to switch to the BBDB buffer. If the buffer is not onscreen or does not contain the entry you want to edit, press M-x and type bbdb to find and display the entry.

If you want to edit an existing field, press e on top of the field. If you want to add a new field instead, press C-o. A few fields are special to BBDB, and you should seldom need to add new ones, but you are perfectly allowed to. As in many other places, completion is available when you tell BBDB which field you want to add.

Finally, deleting a field is done by pressing d on top of it. Pressing d on top of the name field means to delete the whole entry in the database.

Selecting an Address from the Database

What you really need a database for is to look up an email address, given a person's given name, right? Using BBDB, this is especially simple--just type part of his name and then type M-TAB. If the name matches several persons, then a BBBD window is shown, where you can see the possible matches, and eventually select one.

Mail Aliases (Local Mailing Lists)

In some circumstances it is useful to send a letter to several people, such as co-workers, people who have a common interest with you, or people who appreciate getting a joke sent to them from you.

BBDB can help you set up such a mailing list . This is done by adding a mail alias to each of the entries for the persons for this mailing list, as the following tasks shows.

Note - Because the words mailing list make people think about a public mailing list where you can send a letter and from which your letter is sent to a number of people, the topic in the rest of this section be referenced to as mail aliases (which it also is in the BBDB documentation).

Creating a List of Email Addresses

Follow these steps to learn how to set up a mail alias using BBDB:

1. Find a good name for your mailing alias. This might for example be joke-lovers, work-group, or depeche-fans.

2. Find the BBDB entry for a person who should be on this list. You can use the command bbdb or bbdb-name to search for her.

3. Switch to the BBDB buffer and press C-o. This makes Emacs ask for the name of the field to add.

4. Type mail-alias and press Enter. The very first time you add a mail alias, it is not possible to complete the name, but it is subsequent times. The first time BBDB also complains that it doesn't know this field, and asks you if you want to add it. You do!

5. Now type the name you found in step 1.

6. Repeat steps 2-5 for each of the people who should be on this list.

Well that's it! Given that you have a line in your .Gnus file that says (sams-bind-alias-tabs-in-gnus), all should work fine. You can define as many aliases for a person as you want. In these cases, simply separate each alias with a comma.

When you want to send mail to the your newly created mail alias, type the name of the list and press M-TAB as you would do with any ordinary mail address. This can be seen in Figures 21.6 and 21.7.

Figure 21.6
Mail buffer just before pressing M-TAB to expand the mail alias joke-lover.

Figure 21.7
Mail buffer just after having pressed M-TAB.

Caution - There is one pitfall with these mail aliases. You can't autocomplete their names! In the example in Figures 21.6 and 21.7, you can't just type joke- and press M-TAB; you need to type the name in full, and press M-TAB.


Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 21: Advanced Gnus

Previous HourNext Hour

Sections in this Hour: