[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

10. Aliases

MH aliases are used in the same way in MH-E as they are in MH. Any alias listed as a recipient will be expanded when the message is sent. This chapter discusses other things you can do with aliases in MH-E.

The following commands are available in MH-Letter mode with the exception of mh-alias-reload which can be called from anywhere.

<SPC>

Perform completion or insert space (mh-letter-complete-or-space).

M-<TAB>

Perform completion on header field or word preceding point (mh-letter-complete).

mh-alias-apropos

Show all aliases or addresses that match a regular expression.

mh-alias-grab-from-field

Add alias for the sender of the current message

mh-alias-reload

Reload MH aliases.

The ‘mh-alias’ customization group contains options associated with aliases.

mh-alias-completion-ignore-case-flag

On means don't consider case significant in MH alias completion (default: ‘on’).

mh-alias-expand-aliases-flag

On means to expand aliases entered in the minibuffer (default: ‘off’).

mh-alias-flash-on-comma

Specify whether to flash address or warn on translation (default: ‘Flash but Don't Warn If No Alias’).

mh-alias-insert-file

Filename used to store a new MH-E alias (default: ‘Use Aliasfile Profile Component’).

mh-alias-insertion-location

Specifies where new aliases are entered in alias files (default: ‘Alphabetical’).

mh-alias-local-users

If ‘on’, local users are added to alias completion (default: ‘on’).

mh-alias-local-users-prefix

String prefixed to the real names of users from the password file (default: "local.".

mh-alias-passwd-gecos-comma-separator-flag

On means the GECOS field in the password file uses a comma separator (default: ‘on’).

The following hook is available.

mh-alias-reloaded-hook

Hook run by mh-alias-reload after loading aliases (default: nil).

Adding Addresses to Draft

You can use aliases when you are adding recipients to a message.

In order to use minibuffer prompting for recipients and the subject line in the minibuffer, turn on the option mh-compose-prompt-flag (voir la section Composing), and use the <TAB> (minibuffer-complete) command to complete aliases (and optionally local logins) when prompted for the recipients. Turn on the option mh-alias-expand-aliases-flag if you want these aliases to be expanded to their respective addresses in the draft.

Otherwise, you can complete aliases in the header of the draft with M-<TAB> (mh-letter-complete) or <SPC> (mh-letter-complete-or-space).

As MH ignores case in the aliases, so too does MH-E. However, you may turn off the option mh-alias-completion-ignore-case-flag to make case significant which can be used to segregate completion of your aliases. You might use uppercase for mailing lists and lowercase for people. For example, you might have:

 
mark.baushke: Mark Baushke <mdb@stop.mail-abuse.org>
MH-E: MH-E Mailing List <mh-e-devel@stop.mail-abuse.org>

When this option is turned off, if you were to type M in the ‘To:’ field and then M-<TAB>, then you'd get the list; if you started with m and then entered M-<TAB>, then you'd get Mark's address. Note that this option affects completion only. If you were to enter Mark.Baushke, it would still be identified with your ‘mark.baushke’ alias.

To verify that the alias you've entered is valid, the alias will be displayed in the minibuffer when you type a comma (mh-letter-confirm-address or mh-alias-minibuffer-confirm-address if the option mh-compose-prompt-flag is turned on). Voir la section Composing. This behavior can be controlled with the option mh-alias-flash-on-comma which provides three choices: ‘Flash but Don't Warn If No Alias’, ‘Flash and Warn If No Alias’, and ‘Don't Flash Nor Warn If No Alias’.

For another way to verify the alias expansion, see Checking Recipients.

Loading Aliases

MH-E loads aliases for completion and folder name hints from various places. It uses the MH command ali(47) to read aliases from the files listed in the profile component ‘Aliasfile:’ as well as system-wide aliases (for example, ‘/etc/nmh/MailAliases’).

In addition, aliases are created from ‘/etc/passwd’ entries with a user ID larger than a magical number, typically 200. This can be a handy tool on a machine where you and co-workers exchange messages. These aliases have the form ‘local.first.last’ if a real name is present in the password file. Otherwise, the alias will have the form ‘local.login’.

The prefix ‘local.’ can be modified via the option mh-alias-local-users-prefix. This option can also be set to ‘Use Login’.

For example, consider the following password file entry:

 
psg:x:1000:1000:Peter S Galbraith,,,:/home/psg:/bin/tcsh

The following settings of option mh-alias-local-users-prefix will produce the associated aliases:

"local."

local.peter.galbraith

""

peter.galbraith

Use Login

psg

In the example above, commas are used to separate different values within the so-called GECOS field. This is a fairly common usage. However, in the rare case that the GECOS field in your password file is not separated by commas and whose contents may contain commas, you can turn the option mh-alias-passwd-gecos-comma-separator-flag off.

If you're on a system with thousands of users you don't know, and the loading of local aliases slows MH-E down noticeably, then the local alias feature can be disabled by turning off the option mh-alias-local-users. This option also takes a string which is executed to generate the password file. For example, use ‘ypcat passwd’ to obtain the NIS password file.

Since aliases are updated frequently, MH-E reloads aliases automatically whenever an alias lookup occurs if an alias source has changed. However, you can reload your aliases manually by calling the command M-x mh-alias-reload directly. This command runs mh-alias-reloaded-hook after the aliases have been loaded.

Adding Aliases

In the past, you have manually added aliases to your alias file(s) listed in your ‘Aliasfile:’ profile component. MH-E provides other methods for maintaining your alias file(s).

You can use the M-x mh-alias-add-alias command which will prompt you for the alias and address that you would like to add. If the alias exists already, you will have the choice of inserting the new alias before or after the old alias. In the former case, this alias will be used when sending mail to this alias. In the latter case, the alias serves as an additional folder name hint when filing messages (voir la section Folder Selection).

Earlier, the alias prefix ‘local’ was presented. You can use other prefixes to organize your aliases or disambiguate entries. You might use prefixes for locales, jobs, or activities. For example, I have:

 
; Work
attensity.don.mitchell: Don Mitchell <dmitchell@stop.mail-abuse.com>
isharp.don.mitchell: Don Mitchell <donaldsmitchell@stop.mail-abuse.com>
...
; Sport
diving.ken.mayer: Ken Mayer <kmayer@stop.mail-abuse.com>
sailing.mike.maloney: Mike Maloney <mmaloney@stop.mail-abuse.com>
...
; Personal
ariane.kolkmann: Ariane Kolkmann <ArianeKolkmann@stop.mail-abuse.com>
...

Using prefixes instead of postfixes helps you explore aliases during completion. If you forget the name of an old dive buddy, you can enter ‘div’ and then <SPC> to get a listing of all your dive buddies.

An alias for the sender of the current message is added automatically by clicking on the ‘Grab From alias’ tool bar button or by running the M-x mh-alias-grab-from-field command. Aliases for other recipients of the current message are added by placing your cursor over the desired recipient and giving the M-x mh-alias-add-address-under-point command.

The options mh-alias-insert-file and mh-alias-insertion-location controls how and where these aliases are inserted.

The default setting of option mh-alias-insert-file is ‘Use Aliasfile Profile Component’. This option can also hold the name of a file or a list a file names. If this option is set to a list of file names, or the ‘Aliasfile:’ profile component contains more than one file name, MH-E will prompt for one of them.

The option mh-alias-insertion-location is set to ‘Alphabetical’ by default. If you organize your alias file in other ways, then the settings ‘Top’ and ‘Bottom’ might be more appropriate.

Querying Aliases

If you can't quite remember an alias, you can use M-x mh-alias-apropos to show all aliases or addresses that match a regular expression (see the section Syntax of Regular Expressions in The GNU Emacs Manual).


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 27 Octobre 2007 en utilisant texi2html 1.78.