Copyright (C) 1996, 1997 Malc Arnold, Emma Kemm, Kay Dekker. Derived in parts from the GNU Emacs Manual, Eleventh Edition, Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the sections entitled "Distribution" and "GNU General Public License" are included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled "Distribution" may be included in a translation approved by the author instead of in the original English, and the section entitled "GNU General Public License" may be included in a translation approved by the Free Software Foundation instead of in the original English.
This manual documents the use and simple customisation of the af mail reader and composer. The reader is not expected to be a programmer; simple customisations do not require programming skills. If you are not interested in customising then you can ignore the customisation hints. This manual is primarily intended as a reference manual, but can also be used as a primer.
To find the documentation on a particular command, look in the index. Keys (character commands) and command names have separate indexes. There is also a glossary, with a cross reference for each term.
This manual is available as a printed book and also as an Info file, which can be browsed on-line using either GNU Emacs or the info program from the GNU project. The Info file and the printed book contain substantially the same text and are generated from the same source files, which are distributed along with af.
Af is free software; this means that everyone is free to use it and free to redistribute it on certain conditions. Af is not in the public domain; it is copyrighted and there are restrictions on its distribution, but these restrictions are designed to permit everything that a good cooperating citizen would want to do. What is not allowed is to try to prevent others from further sharing any version of af that they might get from you. The precise conditions are found in the GNU General Public License that comes with af and also appears following this section.
The simplest way to get a copy of af is from someone else who has it. You need not ask for permission to do so, or tell anyone you have done so; just copy it. If you have access to the Internet, you can get the latest version, or a patch to upgrade to the latest version, from the Af Home Page on the World Wide Web `http://www.thing.demon.co.uk/af', or by anonymous FTP from `ftp://ftp.csv.warwick.ac.uk/pub/mail/af'.
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--- to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
NO WARRANTY
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
one line to give the program's name and an idea of what it does. Copyright (C) 19yy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
You are reading about af, an advanced, self-documenting, customisable, real-time display-oriented mail reader and composer. If you think that sounds rather like the Emacs editor, you're correct; af is designed to follow the Emacs paradigm as closely as possible.
We say that af is display-oriented because normally the messages being read are visible on the screen and are updated automatically as you type your commands. See section The Organization of the Screen.
We call it a real-time mail reader because the display is updated very frequently, usually after each character or pair of characters you type. This minimises the amount of information you must keep in your head as you process your mail. See section Basic af Commands.
We call af advanced because it provides facilities that go beyond simple reading of messages: viewing multiple mail folders at once, searching and sorting mailboxes, and dealing with groups of messages in one operation.
Similarly, we have tried to take care that af complies with any relevant standards: it conforms closely to RFC822, the Internet Standard for Mail Messages, and will work with such standard Mail Transfer Agents as UUCP, sendmail, and MMDF; and supports the POP3 protocol for reading mail from a remote server. Af also has limited support for MIME mail, which we hope to improve in the future (1).
Self-documenting means that help about af is available from within af itself. You can find out what any command does, or find all the commands that are relevant to a topic. See section Help.
Customisable means that you can change the definitions of af commands in little ways. For example, if you prefer to include the text of the original message into the text of a reply to that message, then you can tell af to do so. Another sort of customisation is rearrangement of the command set. For example, if you prefer the four basic cursor motion commands (up, down, left and right) on keys in a diamond pattern on the keyboard, you can rebind the keys that way. See section Customisation.
Several people have contributed to af's development. Here's my chance to thank them for their efforts, and for an attempt at a moment of glory.
Sometimes you will run into a bug in af. Although I can't promise that I can or will fix the bug, and I may not even agree that it is a bug, I want to hear about problems you encounter. Often I will agree that they are bugs and want to fix them.
If af should ever crash (ie fall over with an operating system error message), or exit back to the shell without warning, then it is certainly a bug. Commands doing the "wrong thing" are also bugs, but you should check the manual and help entry for the command carefully to be sure that the command isn't doing what it is supposed to.
If you think that you've found a bug, it is important to report it, and to provide enough information with the report to be useful. The most useful kind of bug report (except the fix for it) is an exact description of what commands you type, from entering af until the bug manifests. It may also help if you could include a small folder which triggers the bug, since many af bugs can be related to the data in the current folders. It is also important to tell me which version of af you are using, and what machine it is running on. You can find out which version of af you are using by typing M-x af-version RET.
At present, I am also interested in any feedback on af. If you have comments, praise, criticisms or complaints, then we'd like to hear it.
The best way to send bug reports or comments is to mail them electronically to the af maintainer at `af-bug@csv.warwick.ac.uk'. I don't promise to fix the problem; but if I agree that its a bug then I'll most likely want to fix it. And remember that the clearer your bug report is, the more likely it is that the bug will get fixed quickly, or indeed at all.
Af has now been released, but this doesn't mean that it is complete. There are several major enhancements that af could benefit from, some of which are loosely planned to be done at some time in the future.
If you have any strong preferences about the direction af should take in the future, or suggestions of other enhancements you think I might like to consider, then please mail them to me at `af-bug@csv.warwick.ac.uk'.
Electronic mail (often known as e-mail, or simply mail), is the exchange of messages between people using computer networks. In this manual, when we say mail, we mean electronic mail. A mail message is a message which has been or will be sent via electronic mail. Again, when we say message in this manual, we are referring to a mail message.
When a mail message is sent, it is transmitted from one computer to another until it reaches the correct one. A message can be addressed to more than one person, in which case a separate copy of the message is sent to each person. Once a message has reached the machine to which it was addressed, then it is usually stored in the incoming mailbox of the person it is addressed to.
An incoming mailbox, or mailbox is simply a file containing mail messages, with a special sequence of characters separating each message from the others. Each user of a system will normally have their own mailbox. Users can also store messages in files of their own, which are called folders. In this manual, the term folder will refer to any file which contains mail messages.
To read your mail, you will usually use a mail reader, a program which can understand the format of a folder and present the contents to you in a convenient form. Af is an example of a mail reader. Similarly, you would normally send mail by using a mail composer, a program which knows how to construct and send a mail message, and gives the user a (hopefully) convenient environment in which to compose and send their message. Most mail readers, including af, are also mail composers.
To allow a mail message to be sent to the correct person, it needs an envelope. To supply this, a mail message is divided up into two parts, the headers and the body. The headers supply the information required to send the message to the right people, while the body is the actual message you wanted to send.
The headers of a mail message are held at the beginning of the message, and are separated from the message body by a blank line. Here's an example of message headers:
From malc@thing.demon.co.uk Tue Jan 23 16:20:39 1996 Date: Tue, 23 Jan 1996 16:20:36 GMT Message-Id: <4780.199201201539@thing.demon.co.uk> From: Malc Arnold <malc@thing.demon.co.uk> Organization: Team Limpid Sender: The Management <root@thing.demon.co.uk> To: Kay Dekker <kay@thing.demon.co.uk>, Andrew Fry <vic@pootug.demon.co.uk> Subject: Af manual in progress Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
Note that apart from the first line, each header consists of a header name, followed by a colon and then the header text. The first line is not really a header at all; it is the marker that most Unix systems insert to mark the start of each new message. You can also see that unlike the envelope for a postal letter, the envelope information contained in the header can also be of interest to the recipient. There are actually several other headers contained in most mail messages, but by default af will filter them out when it displays a message for you to read (see section Reading Messages).
Another interesting feature is the `To:' header, which has been extended over two lines by starting the second line with a tab. You can also continue headers in the same way by starting the following line with a space. Probably it's best to try to keep headers to a single line though; if a long header line needs to be folded like this, then af will normally do so for you.
Here is a brief summary of some of the headers you are likely to see in a mail message.
Mail addresses usually take the form `user@full.domain.name'. They may also be written as `Full Name <user@full.domain.name>', or `user@full.domain.name (Full Name)'. In all of these cases, the address of the user is the same; the addition of the full name is simply a convenience to allow mail readers to display the sender's real name rather then their e-mail address.
Usually, the part of the address to the left of the "@" character (`user') identifies the user to which the mail is to be sent, while the part to the right (`full.domain.name') identifies the specific computer or organisation where that user can be found. Note that while mail addresses must be unique, a user name may be duplicated many times by different organisations; each with a different full domain name.
Lists of addresses (such as in a `To:' header) should be separated either by spaces or commas.
We shall not go into the intimate details of mail address syntax here; af will check any addresses you give it, and either correct minor problems or report any serious errors in an address.
Normally, the body of a mail message is just text, which is not handled in any special way. Recently, electronic mail has been extended to allow for a message body which is something other than text. These extensions are called MIME (Multipurpose Internet Mail Enhancements), and mail which makes use of them is called MIME mail.
The version of af you are using may use an external program to display mail in MIME format. Otherwise, MIME mail will be displayed just like any other message, which will probably not be helpful if the message is an encoded image or other binary data. We hope to add more powerful and better-integrated support for MIME into later versions of af.
One of the commonest uses of MIME (in Europe at least) is to send
mail which contains characters which aren't in the us-ascii
character set, such as accented characters. Af can be set up so that
it doesn't use an external pager to display such messages, by setting
the variable viewable-charsets
(see section Variables).
It is common for people to want to include a small amount of text at the end of each message, to give information such as their telephone number, paper-mail ("snail-mail") address, other e-mail addresses. and so on.
To aid people in doing this, af supports a feature known as
signature files. These files contain text which will
automagically be included at the end of each mail message you send. By
default, af's uses the file .signature
in your home directory as
your signature file.
Some people also like to include lengthy quotations, large ASCII graphics or other amusements in signature files. This annoys many people on the net, since it costs money to transfer large signatures, and conveys no useful information. Because of this, the version of af which you use may be configured to truncate signature files that are larger than a certain size; typically 4 lines of 79 columns each. You have been warned.
Normally, the af display occupies the whole screen. When you start af, the entire screen except for the last line is devoted to the folder you are reading. This area is called the window. The last line is a special echo area or minibuffer window where prompts appear and where you can enter responses. You can subdivide the window into different windows, each of which can be used to display a different folder (see section Multiple Windows). In this manual, the word "window" always refers to the subdivisions of the screen within af.
The window that the arrow cursor is in is the selected window, in which most operations take place. Most af commands implicitly apply to the messages in the selected window. The other windows display messages for reference only, unless/until you select them.
Most windows display the details of folders, showing a header line for each message in the folder. Each header line shows a brief summary of the message's details, and is treated as a pointer to the message it describes.
Each window's last line is a mode line which describes what is going on in that window. It contains text that starts like `==== Af: something'. Its purpose is to indicate what buffer is being displayed above it in the window above it, how many messages are in the buffer, whether the buffer contains unsaved changes, and so on.
Within a buffer displaying a folder, an arrow pointer shows the location at which commands will take effect. This location is called point. Many af commands move point through the buffer, so that you can execute commands at different places in it.
While the arrow appears to point at a message, you should think of point as between two messages; it lies before the message that it is pointing at. Sometimes people speak of "the cursor" when they mean "point", or speak of commands that move point as "cursor motion" commands.
If you are reading several folders in af, each in its own buffer, each buffer has its own point location. A buffer that is not currently displayed remembers where point is in case you display it again later.
When there are multiple windows on the screen, each window has its own point location. The arrow shows the location of point in the selected window. This also is how you can tell which window is selected. If the same buffer appears in more than one window, each window has its own position for point in that buffer.
It is possible to move point past the last message in a buffer. This is deliberate, to allow several other commands to work properly in an "Emacs-like" way. While it may seem strange at first if you are used to other mail readers, it soon becomes familiar; and it allows you to use many af features much more easily. Most commands that deal with messages will report an error if you have moved point past the last message in the buffer, just as they would if there were no messages at all.
The line at the bottom of the screen (below the mode line) is the echo area. It is used to display small amounts of text for several purposes.
Echoing means displaying the characters that you type. Outside af, the operating system normally echoes all your input. Inside af things work a little differently.
Single-character commands do not echo in af, and multi-character
commands echo only if you pause while typing them. As soon as you pause
for more than a second in the middle of a command, af echoes all the
characters of the command so far. This is to prompt you for the
rest of the command. Once echoing has started, the rest of the command
echoes immediately as you type it. This behaviour is designed to give
confident users fast response, while giving hesitant users maximum
feedback. You can change this behaviour by setting the variable
echo-keystrokes
(see section Variables).
If a command cannot be executed, it may print an error message in the echo area. Error messages are accompanied by a beep.
Some commands print informative messages in the echo area. These messages look much like error messages, but they are not announced with a beep. Sometimes the message tells you what the command has done, when this is not obvious from looking at the screen. Sometimes the sole purpose of a command is to print a message giving you specific information--for example, C-x = prints a message describing the position of point in the buffer. Commands that take a long time often display messages ending in `...' while they are working, and add `done' at the end when they are finished.
The echo area is also used to display the minibuffer, a window that is used for reading arguments to commands, such as the name of a file to be read. When the minibuffer is in use, the echo area begins with a prompt string that usually ends with a colon; also, the cursor appears in that line because it is the selected window. You can always get out of the minibuffer by typing C-g (see section The Minibuffer).
Most of the lines in a window which displays a folder will be header lines, which present a one-line summary of a mail message. By default a header line will look something like this:
ptr tags originator subject
ptr is the pointer which indicates the position of point in the window; the ptr will be represented as `=>' only on the line that point lies before, and as blank on all other lines. The line on which the pointer is present is sometimes referred to as the current line, and the message it represents as the current message, or the message at point.
tags are the tags of the message. Normally, this will only show system tags which af sets to show information about a message's status (see section Tags).
originator is the sender of the message. If the sender's real name is available in the message headers then it will be shown here, otherwise their e-mail address will be displayed.
subject is the subject of the message.
It is possible to change the layout of the header lines by setting the
variable header-line-format
(see section Variables). Also, the arrow
pointer can be changed by setting the variable header-line-arrow
.
Each window's last line is a mode line which describes what is going on in that window. When there is only one window, the mode line appears right above the echo area. The mode line starts and ends with dashes, and it contains text like `Af: something'.
Normally, the mode line looks like this:
=ch= Af: buf == count == (modes) == pos =
This gives information about the buffer being displayed in the window: the buffer's name, what modes are in use, whether the buffer has been changed, and how far down the buffer you are currently looking.
ch contains two stars `**' if the buffer has been changed (the buffer is "modified"), two plus signs `++' if the buffer contains messages whose status has changed, or `==' if the buffer has not been changed. For a read-only buffer, it is `%*' if the buffer is modified, and `%%' otherwise.
buf is the name of the window's buffer. In most cases this is the same as the name of a folder you are processing. (see section Using Multiple Buffers)
count is the number of messages in the window's buffer.
The buffer displayed in the selected window (the window that the arrow cursor is in) is also af's selected buffer, the one that most commands operate on. When we speak of what some command does to "the buffer", we are talking about the currently selected buffer.
pos tells you whether there are more messages above the top of the window, or below the bottom. If your buffer is small and it is all visible in the window, pos is `All'. Otherwise, it is `Top' if you are looking at the beginning of the buffer, `Bot' if you are looking at the end of the buffer, or `nn%', where nn is the percentage of the buffer above the top of the window.
modes lists the major mode and any minor modes which are in effect in the buffer. At any time, each buffer is in one and only one of the possible major modes. The major modes available include Mail mode (for reading folders), Typeout mode (for displaying information) and Minibuffer mode (for asking the user for input). Each major mode may be supplemented by one or more minor modes, which change the mode's behaviour in some small way. (see section Major Modes).
It is possible to change the layout of the mode line by setting the
variable mode-line-format
(see section Variables).
ASCII consists of 128 character codes. Some of these codes are assigned graphic symbols such as `a' and `='; the rest are control characters, such as Control-a (usually written C-a for short). C-a gets its name from the fact that you type it by holding down the CTRL key while pressing a.
Some control characters have special names, and special keys you can type them with: for example, RET, TAB, LFD, DEL and ESC. The space character is usually referred to below as SPC, even though strictly speaking it is a graphic character whose graphic happens to be blank.
On ASCII terminals, there are only 32 possible control characters. These are the control variants of letters and `@[]\^_'. In addition, the shift key is meaningless with control characters: C-a and C-A are the same character, and af cannot distinguish them.
One af character set extension is that characters have an additional modifier, called Meta. Every character has a Meta variant; examples include Meta-a (normally written M-a, for short), M-A (not the same character as M-a, but those two characters normally have the same meaning in af), M-RET, and M-C-a. For reasons of tradition, we usually write C-M-a rather than M-C-a; logically speaking, the order in which the modifier keys CTRL and META are mentioned does not matter.
Some terminals have a META key, and allow you to type Meta characters by holding this key down. Thus, Meta-a is typed by holding down META and pressing a. The META key works much like the SHIFT key. Such a key is not always labelled META, however, as this function is often a special option for a key with some other primary purpose.
If there is no META key, you can still type Meta characters using two-character sequences starting with ESC. Thus, to enter M-a, you could type ESC a. To enter C-M-a, you would type ESC C-a. ESC is allowed on terminals with META keys, too, in case you have formed a habit of using it. ASCII terminals represent function keys as a special sequence of ASCII characters. Because of this, it is possible, although not simple, to configure af to handle function and arrow keys. (see section Customisation)
A key sequence (key, for short) is a sequence of characters that are meaningful as a unit--as "a single command." Some af command sequences are just one character; for example, just C-n is enough to move down one line. But af also has commands that take two or more characters to invoke.
If a sequence of events is enough to invoke a command, it is a complete key. Examples of complete keys include C-n, RET, C-x C-f and C-x 4 C-f. If it isn't long enough to be complete, we call it a prefix key. The above examples show that C-x and C-x 4 are prefix keys. Every key sequence is either a complete key or a prefix key.
Many single characters constitute complete keys in the standard af command bindings. A few of them are prefix keys. A prefix key combines with the following character to make a longer key sequence, which may itself be complete or a prefix. For example, C-x is a prefix key, so C-x and the next character combine to make a two-character key sequence. Most of these key sequences are complete keys, including C-x C-f and C-x b. A few, such as C-x 4 and C-x r, are themselves prefix keys that lead to three-character key sequences. There's no limit to the length of a key sequence, but in practice people rarely use sequences longer than four characters.
By contrast, you can't add more characters onto a complete key. For example, the two-character sequence C-n C-k is not a key, because the C-n is a complete key in itself. It's impossible to give C-n C-k an independent meaning as a command. C-n C-k is two key sequences, not one.
All told, the prefix keys in af are C-h, C-t, C-x C-x 4, and ESC. But this is not cast in concrete; it is just a matter of af standard key bindings. If you customise af, you can make new prefix keys, or eliminate these (see section Customising Key Bindings).
If you do make or eliminate prefix keys, that changes the set of possible key sequences. For example, if you redefine C-n as a prefix, C-n C-k automatically becomes a key (complete, unless you define it too as a prefix). Conversely, if you remove the prefix definition of C-x 4, then C-x 4 f (or C-x 4 anything) is no longer a key.
This manual is full of passages that tell you what particular keys do. But af does not assign meanings to keys directly. Instead, af assigns meanings to named commands, and then gives keys their meanings by binding them to commands.
Every command has a name chosen by a programmer. The name is usually
made of a few English words separated by dashes; for example,
next-line
or open-message
. The bindings between keys and
commands are recorded in various tables called keymaps
(see section Customising Key Bindings).
When we say that "C-n moves down vertically one line" we are
glossing over a distinction that is irrelevant in ordinary use but is
vital in understanding how to customise af. It is the command
next-line
that is programmed to move down vertically. C-n
has this effect because it is bound to that command. If you
rebind C-n to the command end-of-buffer
then C-n will
move to the end of the buffer instead. Rebinding keys is a common
method of customisation.
In the rest of this manual, we usually ignore this subtlety to keep
things simple. To give the information needed for customisation, we
state the name of the command which really does the work in parentheses
after mentioning the key that runs it. For example, we will say that
"The command C-n (next-line
) moves point vertically
down," meaning that next-line
is a command that moves vertically
down and C-n is a key that is standardly bound to it.
While we are on the subject of information for customisation only, it's
a good time to tell you about variables. Often the description of
a command will say, "To change this, set the variable foobar
."
A variable is a name used to remember a value. Most of the variables
documented in this manual exist just to facilitate customisation: some
command or other part of af examines the variable and behaves
differently according to the value that you set. Until you are
interested in customising, you can ignore the information about
variables. When you are ready to be interested, read the basic
information on variables, and then the information on individual
variables will make sense (see section Variables).
Af has several modes of operation; known as major modes. A major mode is in effect a subset of af, where a command may have a different effect, and different commands may be available (This is probably the most pronounced difference between af and Emacs; Emacs major modes just alter its behaviour in minor ways, such as changing key bindings; while af major modes may have a completely different set of commands and behaviour).
There are three major modes currently available in af. Mail mode is the mode used for buffers displaying mail messages; most af buffers use mail mode. Minibuffer mode is used to support the minibuffer; it has no commands to handle mail messages, but many extra commands to allow editing of text. Typeout mode is the mode used for displaying text to the screen. Again, it has no commands to handle mail messages, it simply allows you to browse text displayed on the screen.
Each major mode allows you to bind keys independently of the other major modes (just like in Emacs), so keys may be bound in only one mode, or even be bound to different things in different modes (just as they can in Emacs). For example, in mail mode SPC just clears the echo area, in minibuffer mode it inserts a space into the text you are editing, and in typeout mode it scrolls the text up to display the next page.
Each af command may be available in all modes, or just in some of them.
For example the command open-message
is only available in mail
mode, since in the other modes you are not dealing with mail messages
and the command wouldn't make sense. So you can't run the command
open-message
in typeout mode even by typing
M-x open-message.
A command may also have slightly different behaviour in different modes. For example the command search-forward in mail mode searches through the text of each mail message, looking some text. In typeout mode it searches through the text you are viewing instead.
This distinction is only really important when customising af; when you are using af it is (hopefully) quite obvious what commands are likely to work. The important thing to remember is that keys may do very different things depending on whether you are browsing a list of messages, entering an argument in the minibuffer, or viewing text.
A minor mode is a particular feature which can be turned on or off. For
example, Read Only
mode selects whether you are allowed to modify
the contents of a buffer. Unlike the major modes, the minor modes are
independent of each other, although they may only be valid in some major
modes.
Minor modes are usually specific to a buffer, so they may be turned on
in some buffers and off in others. Normally, minor modes are turned on
or off automatically in response to some situation. There may also be a
command to turn the minor mode off if it is on, or on if it is off; this
will be formed from the prefix `toggle-' followed by the name of
the mode. So the command to turn Read Only
mode on or off is
toggle-read-only
.
The usual way to invoke af is with the shell command `af'. Af clears the screen and then displays an initial help message and copyright notice while it processes any startup files (see section The Startup File, `~/.afrc'), and then reads your incoming mailbox. (If your mailbox is small, you may not see the initial help message and copyright; it would be very inconvenient for experienced users if af were to pause long enough to let you read the message.) When af has finished reading the mailbox, it displays a final count of how many messages it read, and displays the buffer containing the messages.
Some operating systems discard all type-ahead when af starts up; they give af no way to prevent this. Therefore, it is advisable to wait until af clears the screen before typing your first command.
It is possible to specify folders to be visited, or details of a message you want to send, by giving af arguments in the shell command line (see section Command Line Arguments). But you can do these things from within af too; whether you run af once and suspend it, or separately each time you want to read or send mail is simply a matter of taste.
Arguments starting with `-' are options. Other arguments specify addresses to send mail to. If you specify addresses, then af doesn't read any folders; it simply allows you to send a single mail message to the addresses you supplied, and then exits.
You can use options to specify various other things, such as which
folders to read, the subject for mail you're sending, and so on. A few
options support advanced usage, such as running afl
functions in
batch mode. The sections of this chapter describe the available
options, arranged according to their purpose.
Most options specify how to initialise af, or set parameters for the af
session. We call them initial options. A few options specify
things to do: for example, read folders or load afl
programs
(see section Afl). These are called action options. These and file
names together are called action arguments. Af processes all the
action arguments in the order they are written.
Here is a table of the arguments and options that af accepts:
edit-initial-headers
variable to be set to true
regardless
of the contents of the user's `.afrc' file
(see section Composing and Sending Mail).
afl
. The
commands in the file are read and executed exactly as if af had been
started up interactively and then the af command load-file
had
been executed. When all the commands in file have been executed,
or if an error is encountered in the file, then af terminates. If the
`-S' option is given, then af will not display the screen; only
messages will be printed to the standard output. Only one `-S'
option may be given, it is ignored if destinations or the `-E'
option were specified.
Here are a few examples of af command line usage, with brief explanations.
Read two folders `foo' and `bar' into separate windows:
af -f foo -f bar -w
Check if there is any mail in folders foo and bar:
af -e -f foo -f bar
Send mail to `fred' on the local system with subject `Hi':
af -s Hi fred
Take a current directory listing, and use it as a base for some mail to user `fred@foobar.co.uk':
ls -l | af -E fred@foobar.co.uk
Run the afl script in file `script.afl' with folder `foobar' as the default buffer:
af -S script.afl -f foobar
Af uses several environment variables. An environment variable is a string passed from the operating system to af, and the collection of environment variables is known as the environment. Environment variable names are case sensitive and it is conventional to use upper case letters only.
Because environment variables come from the operating system there is no
general way to set them; it depends on the operating system and
especially the shell that you are using. For example, here's how to set
the environment variable ORGANIZATION
to `Utter Chaos'
using bash:
export ORGANIZATION="Utter Chaos"
and here's how to do it in csh or tcsh:
setenv ORGANIZATION "Utter Chaos"
It should be noted that the environment variables are used to customise af, not to configure it. None of these variables are required; and af should work correctly without them. They simply serve to tailor af to your taste.
Here is a list of the environment variables af uses, with a brief description of what they are used for.
MAIL
HOME
FOLDER
SAVEDIR
TMPDIR
VISUAL, EDITOR
VISUAL
overrides EDITOR
if they are set
to different values.
PAGER
NAME
ORGANIZATION
There are two commands for exiting af because there are two kinds of exiting: suspending af and killing af.
Suspending means stopping af temporarily and returning control to its parent process (usually a shell), allowing you to resume reading mail later in the same af job, with the same buffers, same kill ring, and so on.
Killing af means destroying the af job. You can run af again later, but you will get a fresh af; there is no way to resume the same mail reading session after it has been killed.
suspend-af
)
save-buffers-kill-af
).
save-all-kill-af
).
To suspend af, type C-z (suspend-af
). This takes you back
to the shell from which you invoked af. You can resume af with the
shell command `%af' in most common shells.
On systems that do not support suspending programs, C-z starts an
inferior shell that communicates directly with the terminal
(shell
). Af waits until you exit the inferior shell. (The way
to do that is probably with C-d or `exit', but it depends on
which shell you use). The only way on these systems to get back to the
shell from which af was run (to log out, for example) is to kill af.
To kill af, type C-x C-c (save-buffers-kill-af
). A
two-character key is used for this to make it harder to type. This
command first offers to save any modified file-visiting buffers. If you
do not save them all, it asks for confirmation with yes before
killing af, since any changes not saved will be lost forever.
To kill af, saving all modified file-visiting buffers, type M-z
(save-all-kill-af
). We don't recommend using this, since you
might accidentally save changes you didn't mean to, but you can use
M-z to exit if you prefer.
The operating system usually listens for certain special characters whose meaning is to kill or suspend the program you are running. This operating system feature is turned off while you are in af. The meanings of C-z and C-x C-c as keys in af were inspired by the use of C-z and C-c on several operating systems as the characters for stopping or killing a program, but that is their only relationship with the operating system. You can customise these keys to run any commands of your choice (see section Customising Key Bindings).
We now give the basics of how to read, save, and delete messages, send mail to people and save your changes back to your mailbox.
The most basic operation in af is to open the current message; to display it's contents via typeout (see section Typeout), or some other pager.
pager
variable, usually `typeout'. If the message is a MIME
message, then use the pager named in the mime-pager
variable
instead if possible.
PAGER
environment variable.
Normally, only mail headers not listed in the
headers-not-displayed
variable will be displayed when you open a
message. A positive numeric argument makes af display all the message's
headers. A negative argument makes af skip all headers, and only
display the body of the message. See section Numeric Arguments for more information
on numeric arguments.
If your external pager doesn't need af to pause after displaying the
message; then you can make reading messages more convenient by setting
the variable pause-after-paging-message
to true
.
To do anything useful with af, you have to know how to move point (see section Point). There are several keys which move point within a buffer.
next-line
).
previous-line
).
move-to-window-line
). Text does not move on the screen.
A numeric argument says which screen line to place point on. It counts
screen lines down from the top of the window (zero for the top line). A
negative argument counts lines from the bottom (-1 for the bottom
line).
beginning-of-buffer
). With
numeric argument n, move to n/10 of the way from the top.
See section Numeric Arguments, for more information on numeric arguments.
end-of-buffer
).
goto-line
). Line 1 is the beginning of the buffer.
Since only part of a large buffer fits in the window, af tries to show the part that is likely to be interesting. The display control commands allow you to specify which part of the buffer you want to see.
recenter
). A numeric argument
n says to move point to screen line n.
scroll-up
).
scroll-down
).
The names of all scroll commands are based on the direction that the
messages move in the window. Thus, the command to scroll forward is
called scroll-up
, since the messages move up.
When scrolling a windowful at a time, af leaves two lines that were
visible before you scrolled still visible afterwards, so that you can
retain the context you were in before you scrolled. The number of lines
of overlap across a C-v or M-v is controlled by the variable
next-screen-context-lines
; by default, it is two.
kill-line
). See section Killing and Yanking.
Here are commands to get information about messages, and your position in the buffer.
what-cursor-position
).
message-info
).
message-tags
).
See section Tags.
At any time in af except when a command is running, you can type
C-g (keyboard-quit
) to quit from what you are doing. If
you have typed part of a command, or a numeric argument, then C-g
will get rid of it. If there isn't a partial command to get rid of,
but you are in the minibuffer or typeout then typing C-g will
exit back to the mail buffer, aborting the command you were running.
This means, that you can always get back to the top level of af by typing C-g C-g. This is useful for aborting commands, or if you are unsure where you are in af.
If you forget what a key does, you can find out with the Help character,
which is C-h. Type C-h k followed by the key you want to
know about; for example, C-h k C-n tells you all about what
C-n does. C-h is a prefix key; C-h k is just one of
its subcommands (the command describe-key
). The other
subcommands of C-h provide different kinds of help. Type
C-h three times to get a description of all the help facilities.
(see section Help).
Any af command can be given a numeric argument (also called a prefix argument), although it may be ignored. Some commands interpret the argument as a repetition count. For example, C-n with an argument of ten moves down ten lines instead of one. With these commands, no argument is equivalent to an argument of one. Negative arguments tell most such commands to move or act in the opposite direction.
If your terminal keyboard has a META key, the easiest way to specify a numeric argument is to type digits and/or a minus sign while holding down the META key. For example,
M-5 C-n
would move down five lines. The characters Meta-1, Meta-2,
and so on, as well as Meta--, do this because they are keys bound
to commands (digit-argument
and negative-argument
) that
are defined to contribute to an argument for the next command.
Another way of specifying an argument is to use the C-u
(universal-argument
) command followed by the digits of the
argument. With C-u, you can type the argument digits without
holding down modifier keys; C-u works on all terminals. To type a
negative argument, type a minus sign after C-u. Just a minus sign
without digits normally means -1.
C-u followed by a character which is neither a digit nor a minus sign has the special meaning of "multiply by four". It multiplies the argument for the next command by four. C-u twice multiplies it by sixteen. Thus, C-u C-u C-n moves down sixteen lines. This is a good way to move down "fast", since it moves about 2/3 of a screen in the usual size screen. C-u is also a handy way of providing an argument when you don't care about the value.
Many commands care only about whether there is an argument, and not
about its value. Other commands care only about the sign of the
argument. For example, the command RET (open-message
) with
no argument shows only some of the message's headers; with a positive
argument, it shows all the headers, and with a negative argument it
shows no headers at all. This may seem strange, but it is a convenient
way of modifying the behaviour of a command.
We use the term "prefix argument" as well as "numeric argument" to emphasise that you type the argument before the command, and to distinguish these arguments from minibuffer arguments that come after the command.
Typeout is the mode af uses to display large amounts of text such as mail messages or help information. When af uses typeout, the typeout window appears, covering the entire screen apart from the echo area. Once you exit typeout, the window disappears, "uncovering" the original windows.
If possible, each line of the text is displayed as a single line on the screen. If a line is too long to fit on a single screen line, then it will be displayed on several screen lines, with a `\' at the extreme right margin of all but the last of them. The `\' says that the following screen line is not really a distinct line in the text, but just the continuation of a line too long to fit the screen. This is called line wrapping, and the lines after the first are often referred to as continuation lines.
When you are viewing typeout, the position indicator in the mode line will often say `MOR'. This is because typeout does not wait to read the entire input before displaying the first page, and since af doesn't know how many lines there are in the text yet, it will give the position as `MOR' to indicate this.
Sometimes, the typeout window will appear, but you will still be able to carry on with some other operation (such as displaying the help options via C-h C-h C-h). In these cases the typeout window will disappear when the operation is completed.
Within typeout, only the cursor motion commands, the scrolling commands and the text searching commands can be used. To exit typeout, simply type C-g. The other af commands are irrelevant when you are just viewing text. Here is a brief summary of the commands available in typeout:
typeout-scroll
).
This is a convenient way of paging through short amounts of text.
scroll-up
).
scroll-down
).
next-line
);
previous-line
);
recenter
).
search-forward
). See section Searching Mail Folders.
search-forward
). See section Searching Mail Folders.
The minibuffer is the facility used by af commands to read arguments more complicated than a single number. Minibuffer arguments can be file names, buffer names, af command names, address lists, and many other things, depending on the command reading the argument. You can use many editing commands in the minibuffer to edit the argument.
When the minibuffer is in use, it appears in the echo area, and the terminal's cursor moves there. The beginning of the minibuffer line displays a prompt which says what kind of input you should supply and how it will be used. Often this prompt is derived from the name of the command that the argument is for. The prompt normally ends with a colon.
Sometimes a default argument appears in parentheses after the colon; it too is part of the prompt. The default will be used as the argument value if you enter an empty argument (e.g., just type RET). For example, commands that read buffer names always show a default, which is the name of the buffer that will be used if you type just RET.
The simplest way to enter a minibuffer argument is to type the text you want, terminated by RET which exits the minibuffer. You can cancel the command that wants the argument, and get out of the minibuffer, by typing C-g.
Sometimes, a default response will already be in the minibuffer when you enter it. If it is completely wrong, then you can type C-a C-k to remove it. These default responses appear for convenience when you are prompted for a long value that you are likely to want to edit, rather then retype from scratch.
Most commands which use typeout allow you to redirect the output into a
file, instead of viewing it. The major exception to this is
RET (open-message
), since there are several ways to
save a message to a file. To redirect typeout to a file simply give the
command a prefix argument of any value; you will be prompted for the
file name using the minibuffer.
Since the minibuffer uses the screen space of the echo area, it can conflict with other ways af customarily uses the echo area. Here is how af handles such conflicts:
To insert printing characters into the minibuffer, just type them. This
inserts the characters you type into the buffer at the cursor (that is,
at point; which has a different appearance in the minibuffer, but
the same meaning). The cursor moves forward, and any text after the
cursor moves forward too. If the text in the buffer is `foobar',
with the cursor before the `b', then if you type xx, you get
`fooxxbar', with the cursor still before the `b'. This all
works because in the minibuffer all the printing characters run the
command self-insert-command
.
Direct insertion works for printing characters and SPC, but other
characters act as editing commands and do not insert themselves. If you
need to insert a control character or a character whose code is above
200 octal, you must quote it by typing the character C-q
(quoted-insert
) first. There are two ways to use C-q:
A numeric argument to C-q specifies how many copies of the quoted character should be inserted (see section Numeric Arguments).
When you have finished entering the text, simply type RET
(newline
) to accept the argument and exit the minibuffer.
To delete a character you have inserted, use DEL
(delete-backward-char
). DEL deletes the character
before the cursor (not the one that the cursor is on top of or
under; that is the character after the cursor). The cursor and
all characters after it move backwards. Therefore, if you type a
printing character and then type DEL, they cancel out.
To delete the character that the cursor is under, use C-d
(delete-char
). This deletes the character, moving all the
characters after the cursor backwards. The cursor is left in place.
Therefore C-d is equivalent to C-f DEL.
To delete the text from the cursor to the end of the line, use
C-k (kill-line
). This kills the characters from
the one the cursor is under to the end of the line, leaving the
cursor at the end of the line (see section Killing and Yanking in the Minibuffer).
To edit the text in the minibuffer, you need to be able to move around in the text. There are several commands available to do this:
beginning-of-line
).
end-of-line
).
forward-char
).
backward-char
).
transpose-chars
).
The minibuffer includes several commands for dealing with words rather than characters. Often these take the usual command for moving point, but use a Meta key rather then a control key:
forward-word
).
backward-word
).
backward-kill-word
).
kill-word
).
downcase-word
).
upcase-word
).
capitalize-word
).
For certain kinds of arguments, you can use completion to enter the argument value. Completion means that you type part of the argument, then af visibly fills in the rest, or as much as can be determined from the part you have typed.
When completion is available, certain keys---TAB, RET, and SPC---are rebound to complete the text present in the minibuffer into a longer string that it stands for, by matching it against a set of completion alternatives provided by the command reading the argument. ? is defined to display a list of possible completions of what you have inserted.
For example, when M-x uses the minibuffer to read the name of a command, it provides a list of all available af command names to complete against. The completion keys match the text in the minibuffer against all the command names, find any additional name characters implied by the ones already present in the minibuffer, and add those characters to the ones you have given. This is what makes it possible to type M-x del SPC m RET instead of M-x delete-message RET (for example).
Case is often significant in completion, because it is significant in many of the names that you can complete (buffer names and file names). Thus, `fo' often does not complete to `Foo'. Completion does ignore case distinctions for certain arguments in which case does not matter (such as af command or configuration variable names).
A concrete example may help here. If you type M-x co TAB,
the TAB looks for alternatives (in this case, command names) that
start with `co'. There are only two: copy-region-as-kill
and copy-tagset-as-kill
. These are the same as far as
copy-
, so the `co' in the minibuffer changes to
`copy-'.
If you type TAB again immediately, there are multiple possibilities for the very next character--it could be `r' or `t'---so no more characters are added; instead, TAB just produces a beep. If you now type ?, af will produce a list of all possible completions to typeout; when you exit typeout, the minibuffer is still waiting for the next character.
If you go on to type r TAB, this TAB sees
`copy-r'. The only command name starting this way is
copy-region-as-kill
, so completion fills in the rest of that.
You now have `copy-region-as-kill' in the minibuffer after typing
just co TAB r TAB. Note that TAB has this
effect because in the minibuffer it is bound to the command
minibuffer-complete
when completion is available.
Here is a list of the completion commands defined in the minibuffer when completion is available.
minibuffer-complete
).
minibuffer-complete-word
).
minibuffer-complete-and-exit
).
minibuffer-list-completions
).
SPC completes much like TAB, but never goes beyond the next hyphen or space. If you have `copy-r' in the minibuffer and type SPC, it finds that the completion is `copy-region-as-kill', but it stops completing after `region-'. This gives `copy-region-'. Another SPC at this point completes to `copy-region-as-'.
There are three different ways that RET can work in completing the minibuffer, depending on how the argument will be used.
Every argument that you enter with the minibuffer is saved on a minibuffer history list so that you can use it again later in another argument. You can think of the minibuffer history as a buffer which you can move through displaying a line at a time.
previous-line
).
next-line
).
beginning-of-buffer
).
end-of-buffer
). This will always move you to the text you
were editing before using the minibuffer history.
search-backward
).
search-forward
)..
The simplest way to reuse the saved arguments in the history list is to move through the history list one element at a time. While in the minibuffer, type C-p to "move to" the previous minibuffer input, and use C-n to "move to" the next input. Similarly, you can use C-< and C-> to "move to" the first and last elements in the history list.
When you move to a new history line, any text you had typed is stored for you as the last history element, so you can return to it by typing M->. To use a history element as the argument, exit the minibuffer as usual with RET. You can also edit the text before you reuse it; this does not change the history element that you "moved" to, but your new argument does go at the end of the history list in its own right.
There are also commands to search forward or backward through the
history. At the moment they search for a history element that starts
with the text you have typed in the minibuffer, up to the position of
the cursor; so typing `list- C-r' will search for a history element
that begins with `list-'. If a matching history element is found
then the cursor will stay in the same column, so that typing C-r
again will search for another history element beginning with
list-
.
Af allows you to compose and send mail as well as read it. There are several different commands to send mail, each of which sends mail in a slightly different way.
Af composes messages in three stages. First you are prompted for any details needed for the message, such as the addresses to send it to. Then af starts an editor, so that you can edit the message. Finally, you are prompted for what to do with the message (its disposition).
There are five commands for sending mail in af. These commands are all similar in use, but conceptually different.
send-mail
).
send-reply
).
group-reply-to-message
).
forward-message
).
bounce-message
).
You will not normally edit the text of the message.
Depending on how you are sending mail, and how you have configured af, you will be prompted for several things when you begin composing a mail message. Normally af will only prompt for `To:' and `Subject:', but here are all the possible questions:
When you first edit a message you will normally see either a blank file or the text of the original message with each line prefixed with `> '. You can then use your editor as usual to compose the text of the message. When you save the message, your `.signature' file will be appended to the message, separated by a line containing `--'.
When you edit a message for the second time (or if you have configured af to do so), the headers of the message are inserted into the file you edit, separated by a blank line, and your signature will be visible at the end of the file. You can edit the headers with your editor, and af will process the changes when you exit the editor; reporting any problems to typeout. You can create headers by adding them into the header section of the file, or delete them by deleting them from the file.
You should be very careful when editing a message's headers. If you accidentally insert a blank line before the headers, then af will not find them when you exit the editor, and will therefore think that you have deleted them all. This can normally be fixed by editing the file again, and removing the offending text from the start of the file.
When you finish editing a message and exit the editor, af will display a summary of the message's headers and prompt you with
Send, Edit, Check spelling, List or Forget?
It is a very good idea to check the headers that af displays, to make sure that you are sending the message to the people you think you are, that the subject is appropriate, and so on. Your options at this point are:
There are a number of configuration variables related to composing and sending mail. Here is a summary of each variable and its effects:
addresses-to-ignore
ask-bcc
true
, then af will prompt for addresses to send blind
copies to whenever you send mail. Default is false
.
ask-cc
true
, then af will prompt for addresses to send copies
to whenever you send mail. Default is false
.
auto-fold-headers
false
, then af will not automagically fold long header
lines onto several lines. Default is true
.
copy-on-reply
false
, af will never quote the text of the original
message in the initial text of a reply. If set to true
af will
always quote the original message. If set to ask
then you will
be asked each time you reply to a message. Defaults to ask
.
copy-preface
copy-prefix
edit-initial-headers
true
, headers will be placed into the file to edit the
first time you edit a message. When set to accept
, headers will
not be displayed for editing, but any valid headers typed at the
start of the message will be accepted. Defaults to false
.
edit-initial-signature
true
, any signature will be placed into the editor
the first time you edit a message. Defaults to false
.
edit-reply-address
true
, allows editing of the destination address when
replying to mail. It is intended for use by people at sites with
inadequate mail configurations. Defaults to false
.
editor
VISUAL
or EDITOR
environment variable.
headers-to-copy
multiple-reply-warning
true
, then af will prompt for confirmation if you try
to reply to a message that you have already replied to. Defaults to
false
.
organization
ORGANIZATION
environment variable.
outbound-folder
outbound-threshold
outbound-folder
. Af will prompt for
confirmation that a message longer than this limit is to be saved. If
set to 0 then all outbound messages will be saved regardless of length.
Default is 100 lines.
preserve-cc-in-group-reply
true
, any Cc:
header on a message is duplicated
in an outgoing group-reply to that message, so that recipients of a
carbon-copy will also receive the reply. Default is true
.
real-name
NAME
environment variable, or your details stored in
the file `/etc/passwd'.
reply-address
signature-file
signature-separator
spell-checker
ispell
is
installed on your system, or unset otherwise.
Af will let you set mail aliases. These are short mnemonic names which stand for mail addresses or groups of mail addresses. Like many other mail programs, af expands aliases when they occur in the `To:', `From:', `Cc:', `Bcc:', and `Reply-to:' headers.
The easiest way to define a mail alias within af is with C-x C-a
(set-alias
). Af will prompt for the alias and then the real name
and the full address of the alias, defaulted from the From: header of
the current message. If the alias already exists, af will prompt for
confirmation that you want to change the alias. (2)
C-x C-a sets the alias internally; but it also writes the alias to the file `.afalias' in your home directory. This file is read whenever af starts up, so your aliases will be available next time you run af. You can also edit your `.afalias' file directly; each line should either be blank, be a comment beginning with `;', or look like:
alias:Real Name:addresses
alias is the name of the alias; Real Name is the real name of the person or group the alias represents, and addresses stands for one or more mail addresses for alias to expand into. Separate multiple addresses with spaces or (preferably) commas. You can make an address list span more than one line by starting the second and subsequent lines with a space or tab, in the same way as mail headers are split over several lines of text.
For instance, to make afbugs
stand for
af-bug@csv.warwick.ac.uk
put in the these lines:
; Set up the af-bug mailing list as an alias afbug:Af Bug Mailing List:af-bug@csv.warwick.ac.uk
Af expands aliases as soon as you finish editing the mail file, so you can check that the alias expanded properly by looking at the list of headers that af shows you when it prompts for the disposition of the mail.
The af commands that are used often or that must be quick to type are bound to keys--short sequences of characters--for convenient use. Other af commands that do not need to be brief are not bound to keys; to run them, you must refer to them by name.
A command name is, by convention, made up of one or more words,
separated by hyphens; for example, af-version
or
list-commands
. The use of English words makes the command name
easier to remember than a key made up of obscure characters, even though
it is more characters to type.
The way to run a command by name is to start with M-x, type the command name, and finish it with RET. M-x uses the minibuffer to read the command name. RET exits the minibuffer and runs the command. The string `M-x' appears at the beginning of the minibuffer as a prompt to remind you to enter the name of a command to be run. See section The Minibuffer, for full information on the features of the minibuffer.
Note that next-line
is the same command that you invoke with the
key C-n. You can run any af command by name using M-x,
whether or not any keys are bound to it.
If you type C-g while the command name is being read, you cancel the M-x command and get out of the minibuffer, ending up at top level.
To pass a numeric argument to the command you are invoking with M-x, specify the numeric argument before the M-x. M-x passes the argument along to the command it runs. The argument value appears in the prompt while the command name is being read.
Normally, when describing a command that is run by name, we omit the RET that is needed to terminate the name. Thus we might speak of M-x af-version rather than M-x af-version RET. We mention the RET only when there is a need to emphasise its presence, such as when we show the command together with following arguments.
M-x works by running the command execute-extended-command
,
which is responsible for reading the name of another command and
invoking it.
Af provides extensive help features accessible through the command
C-h (help-command
). C-h is a prefix key that is used
only for documentation-printing commands. The characters that you can
type after C-h are called help options. One help option is
C-h; that is how you ask for help about using C-h. To
cancel, type C-g.
C-h C-h displays a list of the possible help options. Typing C-h again displays a longer list of the options, each with a brief description.
The most basic C-h options are C-h c
(describe-key-briefly
) and C-h k (describe-key
).
C-h c key prints in the echo area the name of the command
that key is bound to. For example, C-h c C-n prints
`next-line'. Since command names are chosen to describe what
the commands do, this is a good way to get a very brief description of
what key does.
C-h k key is similar but gives more information: it displays the documentation string of the command as well as its name. This is too big for the echo area, so typeout is used for the display.
C-h f (describe-function
) reads the name of an af command,
keyboard macro or afl function using the minibuffer, then displays that
function's documentation string to typeout. For example,
C-h f delete-message RET
displays the documentation of delete-message
. This is the only
way to get the documentation of a command that is not bound to any key
(one which you would normally run using M-x).
C-h v (describe-variable
) is like C-h f but describes
configuration variables instead of commands and functions
(see section Variables).
C-h m (describe-mode
) is also like C-h f but describes
major and minor modes rather than commands and functions
(see section Major Modes).
C-h b (list-bindings
) displays the current key bindings
active in af to typeout. The global bindings are shown first, and then
those for each of the major modes. This be quite a long list, but might
be useful as a wall chart.
C-h d (list-commands
) lists all of af's commands, with
their bindings, to typeout. Bindings which only take effect in mail
mode are listed in square brackets (eg `[M-s]'). Bindings
for typeout mode only are listed in braces (eg `{C-f}').
Bindings that are minibuffer-specific are listed in parentheses (eg
`(SPC)').
C-h C-f lists all of the afl functions to typeout. Only those functions which are not also commands are listed. This is quite a short list at present (see section Afl).
C-h C-k list-kbd-macros
lists all of the named keyboard
macros, with their values, to typeout (see section Keyboard Macros).
C-h C-v lists all of the af configuration variables, with their values, to typeout (see section Variables).
C-h C-a (list-aliases
) lists all the mail aliases you have
defined to typeout, along with their values (see section Defining and Using Mail Aliases).
A more sophisticated sort of question to ask is, "What is relevant for
working with messages?" To ask this question, type C-h a message
RET, which displays a list of all command, function, keyboard
macro and variable names that contain `message', including
open-message
, print-message
, and so on. The bindings for
each command is listed with that command, in the same format as
list-bindings (see section Help for Lists of Things). Similarly the values of keyboard
macros and variables are listed. The a in C-h a stands for
`Apropos'; C-h a runs the command command-apropos
.
Because C-h a looks only for things whose names contain the string which you specify, you must use ingenuity in choosing the string. If you are looking for commands for reading messages and C-h a read-message RET doesn't reveal any, don't give up. Try just read, or just message. Be persistent. Also note that you can use a regular expression as the argument, for more flexibility (see section Syntax of Regular Expressions).
Here is a set of arguments to give to C-h a that covers many
classes of af commands, since there are strong conventions for naming
the standard af commands. By giving you a feel for the naming
conventions, this set should also serve to aid you in developing a
technique for picking apropos
strings.
char, line, word, region, list, buffer, window, file, mode, beginning, end, forward, backward, next, previous, up, down, search, goto, kill, delete, mark, insert, yank, case, set, what, view, describe, default, print, page, message, send.
C-h i (info
) runs the Info program, which is used for
browsing through structured documentation files. The entire af manual
is available within Info. Type h after entering Info to run a
tutorial on using Info.
If something surprising happens, and you are not sure what commands you
typed, use C-h l (view-lossage
). C-h l prints the
last 100 command characters you typed in. If you see commands that you
don't know, you can use C-h c to find out what they do.
Af has numerous major modes, each of which redefines keys and alters the
behaviour of some commands. C-h j (describe-major-mode
)
prints documentation on the current major mode to typeout.
The other C-h options display assorted useful information.
C-h n (view-af-news
) displays information on recent changes
to af. C-h C-w (display-no-warranty
) displays details on
the complete absence of warranty for af. C-h C-c
(describe-copying
) displays the conditions you must obey in
distributing copies of af.
You can use af to handle messages in more sophisticated ways than by simply displaying them; You can save messages to folders, print a hardcopy of them, pipe them into commands, and more.
Most commands that deal with a single message also have similar commands which deal with a set of messages, selected either by using the mark and region (see section The Mark and the Region), or with tags (see section Tags). These similar commands will be covered later.
Af allows you to save messages by copying them to folders. One
way to save a message to a folder is to use M-+
(save-message
). Af will prompt you for the folder name, offering
a default based on the sender's mail address (see section Folder Handling). The
message will be appended to the folder you specify, so any messages
already in the folder will be left unchanged.
When the message is saved to a folder, the original copy is not deleted. an `S' will appear in the system tags of the message, so that you know you have saved it.
M-+ can take a numeric argument, in which case it only saves the body of the message, not the headers. Obviously the file containing a saved copy of the message shouldn't be read with af; it isn't a mail folder. Saving the body of a message can be useful when the body is input for some other program (such as a patch file).
If you save only the body of a MIME message, then af will use the
command listed in the mime-saver
variable to save the message,
to ensure that the message mode is properly decoded before writing it
to the file.
Af allows you to print a hardcopy of a message to a spooler. The
program to use to print hard copies of mail is defined by the
print-command
variable for ordinary text messages, or the
mime-printer
variable for MIME messages.
To print a hardcopy of a message, use C-p (print-message
).
Af will usually prompt you to confirm that you want a hardcopy of the
message; this feature can be turned off by setting the variable
confirm-print
to false
. After you print the message, a
`P' will appear in the system tags of the message, to remind you
that you have printed it.
Normally, only mail headers not listed in the
headers-not-displayed
variable will be printed when you print a
message. A positive numeric argument makes af print all the message's
headers, while a negative argument makes af skip all headers, and only
print the body of the message.
Af allows you to pipe a message into the standard input of a
system command. To do this use M-| (pipe-message
). Af
will prompt for the command to pipe the message into, and then execute
the command. Any output from the command will be displayed on the
screen. Once the command has completed, af will wait for you to press a
key before continuing; giving you a chance to read any output from the
command.
Normally, only mail headers not listed in the
headers-not-displayed
variable will be piped into the command. A
positive numeric argument makes af pass all the message's headers to the
command. A negative argument makes af skip all headers, and only pass
the body of the message to the command.
Af is able to process mail digests; mail messages which themselves contain one or more mail messages. If you receive a mail digest, you can use M-x explode-digest to "explode" the digest back into the messages it contains.
The exploded messages are placed after the digest in the buffer. The mark is set on the first exploded message, and point lies after the last; making it convenient to handle them after exploding the digest.
Af will allow you to edit a message in a folder with C-x C-e
(edit-message
). Af will save the message to a temporary file and
execute an editor to edit the file. When you finish editing, af will
read back the temporary file, and update its internal copy of the
message. When you save the buffer, the modified message will be written
to the folder.
With an argument, C-x C-e will only pass the body of the message to the editor.
Af has commands for running inferior shell processes, displaying the result to typeout or letting the inferior process take control of the terminal.
shell-command-to-typeout
).
shell-command
)
shell
).
Many af commands operate on an arbitrary contiguous part of the current buffer. To specify the text for such a command to operate on, you set the mark at one end of it, and move point to the other end. The text between point and the mark is called the region.
You can move point or the mark to adjust the boundaries of the region. It doesn't matter which one is set first chronologically, or which one comes earlier in the buffer. Once the mark has been set, it remains where you put it until you set it again at another place. Each af buffer has its own mark, so that when you return to a buffer that had been selected previously, it has the same mark it had before.
Many commands that insert messages (or text in the minibuffer), such as
C-y (yank
) and C-x i (insert-file
), position
point and the mark at opposite ends of the inserted text, so that the
region contains the text just inserted.
There are two commands to set the mark in a buffer. These commands work identically in mail buffers, typeout, and the minibuffer.
set-mark-command
).
exchange-point-and-mark
).
For example, suppose you wish to save part of a mail buffer to a folder,
using the C-x + (save-region
) command, which operates on
the messages in the region. You can first go to the beginning of the
messages to be saved, type C-SPC to put the mark there, move
to the end, and then type C-x +. Or, you can set the mark at the
end of the text, move to the beginning, and then type C-x +.
The most common way to set the mark is with the C-SPC command
(set-mark-command
). This sets the mark where point is. Then you
can move point away, leaving the mark behind.
Af doesn't show you where the mark is located. You have to remember.
The usual solution to this problem is to set the mark and then use it
soon, before you forget where it is. Alternatively, you can see where
the mark is with the command C-x C-x
(exchange-point-and-mark
) which puts the mark where point was and
point where the mark was. The extent of the region is unchanged, but
point is now at the previous position of the mark.
C-x C-x is also useful when you are satisfied with the position of point but want to move the mark; do C-x C-x to put point at that end of the region, and then move it. A second use of C-x C-x, if necessary, puts the mark at the new position with point back at its original position.
There is no such character as C-SPC in ASCII; when you type
SPC while holding down CTRL, what you get on most ordinary
terminals is the character C-@. This key is actually bound to
set-mark-command
. But unless you are unlucky enough to have a
terminal where typing C-SPC does not produce C-@, you
might as well think of this character as C-SPC. If you are
on a terminal where C-SPC doesn't work, you could use
M-SPC instead; it is also bound to set-mark-command
.
Once you have a region in a mail buffer, here are some of the commands
that operate on the region. Note that these commands all have the word
region
in their names.
kill-region
).
See section Killing and Yanking.
copy-region-as-kill
). See section Killing and Yanking.
save-region
).
This command handles the argument in the same way as M-+
(save-message
). See section Saving Messages.
print-region
). This command handles the argument in the same
way as M-p (print-message
). See section Printing Messages.
pipe-region
). Again, this command handles
the argument in the same way as M-| (pipe-message
)
See section Piping Messages.
Typeout is only used to display text, and not to edit or delete anything.
For that reason, there are no commands which operate on the region available
in typeout. It is still possible to set the mark in the typeout buffer; but
the only thing you can do with it is to use C-x C-x
(exchange-point-and-mark
) to move back to the mark.
The minibuffer supports the mark and region, but only a subset of the commands which are available in a mail buffer to process the region. Since the minibuffer deals with text rather than messages, the region delimits a block of text in the minibuffer.
Just like any other buffer, the minibuffer has its own mark. The mark is not preserved between uses of the minibuffer, or when you move between minibuffer history entries, so you will usually need to set the mark in the minibuffer before you use it.
There are two commands which operate on the region in the minibuffer:
kill-region
).
See section Killing and Yanking in the Minibuffer.
copy-region-as-kill
). See section Killing and Yanking in the Minibuffer.
The region allows you to conveniently process blocks of messages, but what if you want to handle an arbitrary set of messages? Af uses tags to let you mark a set of messages and process them quickly.
Tags are only available in mail buffers; they wouldn't make any sense in the minibuffer or the mail buffer.
A tag is a single-character mark which is set on a message. A message can have any number of tags set on it. There are two types of tags: system tags which are automatically set by af for various reasons, and user tags which you can set and unset yourself. You cannot set or remove system tags, but you can use them in exactly the same ways as you can user tags.
There are many commands which operate on tagged messages; and you can use either single tags or a combination of them to specify a set of messages to operate on. Tags are central to advanced use of af; they provide a way for you to easily set up a set of messages, which you can then work with in several ways.
The system tags are all upper-case letters, which give information on the status of messages. The possible system tags are:
mime-pager
variable will be used to display it. The exact
meaning of this tag may change as af's MIME support improves.
The user tags you can use are the lower case letters, and `+'. `+' is sometimes called the default tag, since it is the default whenever you are asked about tags.
Normally, the user tags are considered transient, and are lost when you
exit af. If you would like to keep some or all of the tags across mail
reading sessions, then you can set the variable persistent-tags
to the tags you would like to be preserved. For example, setting the
value of persistent-tags
to `aeiou', would mean that the
user tags `a', `e', `i', `o', and `u' will be
preserved whenever you save a folder, but the other tags will be lost.
You cannot make the default tag (`+') persistent.
Whenever you are setting or removing tags, af will expect you to enter a tag list. Tag lists consist of one or more user tags, which may be separated by spaces. For example, `abcd' and `a b c d', both specify a list of four tags, `a', `b', `c', and `d'.
Whenever you are prompted for a tag list, you can just hit return to use the default tag (`+').
When you are using tags to define a set of messages to apply some command to, you will be expected to enter a tag expression. That tag expression is then compared to the tags of each message in the buffer, and the command will operate on the message if the expression is true for that message. We often refer to the messages which match a tag expression as the tagset.
Tag expressions are made up of sub-expressions, which may be system or user tags. You can use operators to combine subexpressions, and build arbitrarily complex expressions. Any tag will evaluate to true if the message being checked has that tag set, false otherwise. The possible operators are, in decreasing precedence:
Here are some examples of tag expressions, with their meanings.
a & b | c & d
True if `a' and `b' are both set, or `c' and `d' are both set.
a & (b | c) & d
True if `a', `d', and either `b' or `c' are set.
a & !b
True if `a' is set and `b' is not set.
a & !(b | c)
True if `a' is set and neither of `b' or `c' are set.
tag-message
).
untag-message
).
remove-tag
).
To tag the current message, use C-t t. You will be prompted for the tags to set; simply type in the tag list to set. The tags in the list will be added to those already set on the message.
To remove one or more tags from the current message use C-t u. You will be prompted for the tags to remove. The tags you specify will be removed from the message's tags.
To remove one or more tags from all the messages in the buffer, use C-t r. You will be prompted for the tags to remove. The tags you specify will be removed from all the messages in the buffer.
The experimental command M-x tag-thread tags RET tags all the messages in a thread of conversation, a set of messages which are all sent as replies to other related messages. (This is similar to the concept of threading found in most news readers.) This command works, but at the moment there are too many mail composers which don't include references to messages when they generate a reply, so that the threads are often broken by replies which af can't detect as a part of the thread. It is probably best not to use this command for the moment, unless you can be sure that all the participants are using a mail composer that does include references to messages in replies.
There is also a command to set tags on messages which match search criteria. See section Tagging Matching Messages.
Once you have tagged messages in the region, you can use single tags or tag expressions to operate on them. Here are some of the ways in which you can operate on tagged messages:
kill-tagset
). See section Killing and Yanking.
copy-tagset-as-kill
). See section Killing and Yanking.
save-tagset
).
This command handles the argument in the same way as M-+
(save-message
). See section Saving Messages.
print-tagset
). This command handles the argument in the same
way as M-p (print-message
). See section Printing Messages.
pipe-tagset
). Again, this command handles
the argument in the same way as M-| (pipe-message
)
See section Piping Messages.
Killing means erasing messages (or text in the minibuffer) and copying them into the kill ring, from which it can be retrieved by yanking it. Some systems use the terms "cutting" and "pasting" for these operations.
The commonest way of moving or copying messages within af is to kill them, and later yank them elsewhere one or more times. This is very safe because af remembers several recent kills, not just the last one. It is versatile, because the many commands for killing messages can also be used for moving them.
Af has only one kill ring for all mail buffers, so you can kill messages in one buffer and yank them in another buffer. The minibuffer has a separate kill ring for storing text.
All commands which delete messages from the buffer save it in the kill
ring (even delete-message
when you save the folder) so that you
can move or copy it to other parts of the buffer. These commands are
known as kill commands.
There are two ways to add messages to the kill ring; killing and copying. Killing means deleting messages and adding them to the kill ring, while copying means copying messages to the kill ring without deleting them.
There are commands to kill a single message (see section Deleting Messages), commands to kill or copy the region (see section Operating on the Region), and commands to kill or copy a tagset (see section Using Tags).
All killed messages are recorded in the kill ring, a list of blocks of messages that have been killed. There is only one kill ring, shared by all mail buffers, so you can kill messages in one buffer and yank them in another buffer. This is the usual way to move messages from one folder to another (See section Saving Messages, for another way).
The command C-y (yank
) reinserts the most recently killed
messages. It leaves the cursor at the end of the text. It sets the
mark at the beginning of the text (see section The Mark and the Region).
C-y can take a numeric argument, in which case it select an earlier kill to yank, rather than the last (see section Yanking Earlier Kills).
Normally, each kill command pushes a new entry onto the kill ring. However, two or more kill commands in a row combine their messages into a single entry, so that a single C-y yanks all the messages as a unit, just as they were before they were killed.
Thus, if you want to yank messages as a unit, you need not kill all of them with one command; you can keep killing line after line, until you have killed them all, and you can still get them all back at once.
Commands that kill forward from point add the messages onto the end of the previous killed messages. Commands that kill backward from point add them onto the beginning. This way, any sequence of mixed forward and backward kill commands puts all the killed messages into one entry without rearrangement. Numeric arguments do not break the sequence of appending kills.
To recover killed messages that are no longer the most recent kill, use
the M-y command (yank-pop
). It takes the messages
previously yanked and replaces them with the messages from an earlier
kill. So, to recover the messages of the next-to-the-last kill, first
use C-y to yank the last kill, and then use M-y to replace
it with the previous kill. M-y is allowed only after a C-y
or another M-y.
You can understand M-y in terms of a "last yank" pointer which points at an entry in the kill ring. Each time you kill, the "last yank" pointer moves to the newly made entry at the front of the ring. C-y yanks the entry which the "last yank" pointer points to. M-y moves the "last yank" pointer to a different entry, and the text in the buffer changes to match. Enough M-y commands can move the pointer to any entry in the ring, so you can get any entry into the buffer. Eventually the pointer reaches the end of the ring; the next M-y moves it to the first entry again.
M-y moves the "last yank" pointer around the ring, but it does not change the order of the entries in the ring, which always runs from the most recent kill at the front to the oldest one still remembered.
M-y can take a numeric argument, which tells it how many entries to advance the "last yank" pointer by. A negative argument moves the pointer toward the front of the ring; from the front of the ring, it moves "around" to the last entry and continues forward from there.
Once the messages you are looking for are brought into the buffer, you can stop doing M-y commands and it will stay there. They are a copy of the kill ring entry, so altering them in the buffer does not change what's in the ring. As long as no new killing is done, the "last yank" pointer remains at the same place in the kill ring, so repeating C-y will yank another copy of the same previous kill.
If you know how many M-y commands it would take to find the messages you want, you can yank those messages in one step using C-y with a numeric argument. C-y with an argument restores the text the specified number of entries back in the kill ring. Thus, C-u 2 C-y gets the next to the last block of killed messages. It is equivalent to C-y M-y. C-y with a numeric argument starts counting from the "last yank" pointer, and sets the "last yank" pointer to the entry that it yanks.
The length of the kill ring is controlled by the variable
kill-ring-max
; no more than that many blocks of killed messages
are saved.
The minibuffer is used for editing text rather than handling mail, so it
has it's own kill ring. Any command which kills more than one character
at a time (the word
and line
killing commands) will store
the killed text in the minibuffer kill ring. You can yank the killed
text back in exactly the same way as killed messages using C-y.
The minibuffer kill commands will append successive kills to the kill
ring, just like the mail buffer kill commands do. If you use M-d
(delete-word
) three times, then the three words you kill will all
be stored in a single kill ring entry; and a single yank will insert
them into the text at point.
For simplicity, the minibuffer kill ring only has one entry, so you can't use M-y in the minibuffer. If many people find this a problem, then it may change at some point in the future.
Af has search commands, which allow you to search through the messages in a buffer and find those which match a regular expression. You can also search for messages which match a tag expression.
search-forward
).
search-backward
).
To do a search on a buffer (whether typeout or a mail buffer), use C-s or C-r. Af will prompt you for the regular expression to search for, and then the search takes place. If no messages match the regular expression then the search will fail with an error.
A second search immediately after the first, will not match the current message, so repeated searches will move through all the messages which match the regular expression. To make this more convenient, the search expression is defaulted to the last one you entered.
The search commands with a numeric argument will only search the headers of the messages. This is often convenient when (for example) looking for messages which are from a particular person.
tag-search-forward
).
tag-search-backward
).
To search for a message matching a tag expression use C-t C-s or C-t C-r. Af will prompt you for the tag expression (see section Tag Expressions) to search for; and then the search takes place. If no messages match the tag expression then the search will fail with an error.
Just as with regular expression searches, a second search immediately after the first, will not match the current message, so repeated searches will move through all the messages which match the tag expression. To make this more convenient, the search expression is defaulted to the last one you entered.
As well as just searching for a regular expression and moving point to
the first matching message, af can tag all the messages which match a
regular expression. To do this use C-t s (search-and-tag
).
You will be prompted for the regular expression to search for, and the
tags to set on the matching messages (see section Setting and Removing Tags). Once the
search has finished, af will report how many messages were tagged.
With a numeric argument this command will only search the headers of the messages. This is often convenient when (for example) looking for messages which are from a particular person or mailing list.
Regular expressions have a syntax in which a few characters are special constructs and the rest are ordinary. An ordinary character is a simple regular expression which matches that same character and nothing else. The special characters are `$', `^', `.', `*', `+', `?', `[', `]' and `\'. Any other character appearing in a regular expression is ordinary, unless a `\' precedes it.
For example, `f' is not a special character, so it is ordinary, and therefore `f' is a regular expression that matches the string `f' and no other string. (It does not match the string `ff'.) Likewise, `o' is a regular expression that matches only `o'. (When case distinctions are being ignored, these regular expressions also match `F' and `O', but we consider this a generalization of "the same string", rather than an exception.)
Any two regular expressions a and b can be concatenated. The result is a regular expression which matches a string if a matches some amount of the beginning of that string and b matches the rest of the string.
As a simple example, we can concatenate the regular expressions `f' and `o' to get the regular expression `fo', which matches only the string `fo'. Still trivial. To do something nontrivial, you need to use one of the special characters. Here is a list of them.
Here is a moderately complicated regex, which you might use to find messages from the af-bug or af-user mailing lists.
^From:.*af-\(bug\|user\)@csv.warwick.ac.uk
Searches in af normally ignore the case of the text they are searching through. Thus, if you specify searching for `foo', then `Foo' and `foo' are also considered a match. Regular expressions, and in particular character sets, are included: `[ab]' would match `a' or `A' or `b' or `B'.
If you set the variable case-fold-search
to false
, then
all letters must match exactly, including case.
Af provides commands for sorting some or all of the messages in a mail buffer. Each command prompts for a sort order, and then sorts the selected messages into that order.
The sort orders which af understands are:
(reverse-)address
(reverse-)date
show-dates-in-local-time
indicates whether dates should be
compared as they are, or converted to your local time before they are
compared (the default).
(reverse-)lines
(reverse-)mailbox
(reverse-)sender
(reverse-)status
(reverse-)subject
(reverse-)tags
When you sort, messages which sort identically will remain in their
original order, so sorting a buffer by date and then subject will result
in the messages being in date order within each subject. This is often
a good approximation to the "threading" that news readers such as
trn
do, and is handy for reading mailing lists.
Af does not sort your folders by default when it reads them. If you
have a preference for reading buffers in a certain order, then you can
set the configuration variable initial-buffer-sort
to the sort
ordering you prefer.
If you are familiar with other mail readers it is worth noting that af, unlike most other mail readers, saves the messages back to the folders in whatever order you sort them into. This can often be convenient when managing large folders.
Narrowing means focusing in on some portion of the buffer, making the rest temporarily inaccessible. The portion which you can still get to is called the accessible part. Canceling the narrowing, which makes the entire buffer once again accessible, is called widening. The amount of narrowing in effect in a buffer at any time is called the buffer's restriction.
Narrowing can make it easier to concentrate on a set of messages by eliminating clutter. It can also be used to restrict the range of operation of a search command or repeating keyboard macro.
narrow-to-region
).
narrow-to-tagset
).
widen
).
When you have narrowed down to a part of the buffer, that part appears to be all there is. You can't see the rest, you can't move into it (motion commands won't go outside the accessible part), you can't change it in any way. However, it is not gone, and if you save the folder all the inaccessible messages will be saved. The word `Narrow' appears in the mode line whenever narrowing is in effect.
One narrowing command is C-x n (narrow-to-region
). It sets
the current buffer's restrictions so that the messages in the region
remain accessible but all messages before or after the region are
inaccessible. Point and mark do not change.
Another narrowing command is C-t n (narrow-to-tagset
). It
prompts for a tag expression, and then set the current buffer's
restrictions so that the messages in the tagset remain accessible but
all the other messages are inaccessible.
The way to cancel narrowing is to widen with C-x w (widen
).
This makes all the messages in the buffer accessible again.
Narrowing can be very useful if you have a set of messages that you want
to deal with independently of any others; such as all the messages from
a mailing list, or from a certain user. Use C-t s
(search-and-tag
) to tag the messages you are interested in, and
then use C-t n to narrow the buffer to only the tagged messages.
When you are done with the messages, use C-x w to widen to buffer.
Another use for narrowing is when you are using tags to kill messages.
You can use C-t n to narrow to the messages you intend to kill,
and then conveniently scan the messages to make sure that you are happy
to kill them all; using C-t u to untag any messages that you
decide you want to keep. Finally you can either kill the tagset with
C-t C-k (kill-tagset
), or set the mark and point at
opposite ends of the buffer and use C-w (kill-region
).
When you have finished, use C-x w to widen the buffer.
The operating system stores data permanently in named files. We refer to files which contain mail messages as folders. In general, the mail messages you process with af come from a folder which will need to be updated to reflect any changes you make.
Unlike most mail readers, af can read in and process several folders simultaneously, which makes it convenient to store messages in several folders rather than leaving them all in your incoming mailbox. Af can actually be used quite conveniently as a small database by using folders to store related messages.
By default, af reads in your incoming mailbox when it starts. You can also use command-line arguments to tell af to read a different folder (see section Command Line Arguments). Or you can tell an existing af to read another folder and prepare a buffer containing a copy of the folder's messages. This is called visiting the folder. Af commands apply to the messages in the buffer; that is, to the copy inside af. Your changes appear in the folder itself only when you save the buffer back into the folder.
Most af commands that operate on a file require you to specify the file name. (Saving and reverting are exceptions; the buffer knows which file name to use for them.) You enter the file name using the minibuffer (see section The Minibuffer). Completion is available, to make it easier to specify long file names (see section Completion).
Many people prefer to keep all their mail folders in one directory; any folders saved from Usenet news (news folders) in another, and so on. To make this kind of operation more convenient, af interprets several characters specially if they appear at the start of the file name.
folder
.
This is either extracted from the environment variable FOLDER
, or
defaulted to `~/Mail'. So `+af' will usually expand to
`~/Mail/af'. You will need to create the directory yourself if you
plan to use it; af won't create it for you.
news-folder
. This is either
extracted from the environment variable SAVEDIR
, or defaulted to
`~/News'. So `=Comp.mail.headers' will usually expand to
`~/News/Comp.mail.headers'. Normally your news-reader will have
created this directory for you.
Af has a current directory, sometimes referred to as the working directory, which is normally the directory you were in when you ran af. When you enter a folder name without a directory or a special prefix, the current directory is used. If you specify a directory in a relative fashion, with a name that does not start with either a special prefix or a slash, it is interpreted with respect to the current directory.
For example, if the current directory is `/home/malc/src/af' and you type just `foo', which does not specify a directory, it is short for `/home/malc/src/af/foo'. `../../.afrc' would stand for `/home/malc/.afrc'. `new/foo' would stand for the file name `/home/malc/src/af/new/foo'.
The command M-x pwd prints af's current directory, and the command
M-x cd sets it (to a value read using the minibuffer). Af's
current directory can only be changed by using the cd
command.
Af supports a mail protocol called POP3, which allows you to read a folder over a network. This allows people to read mail on a small machine which doesn't have a mail system itself; you simply connect to the POP server where your mail is stored, and read your mail over the network.
Your incoming mailbox may live on a POP server, or you may have a separate POP3 mailbox somewhere. To access a POP3 folder use a filename beginning in a colon. Two forms of POP3 folder name are acceptable: `:server' or `:user@server'. The first form implies that the username to use on server is the same one that you are currently logged in as; the second explicitly specifies the username to use to connect to the POP server.
Once af has opened a connection to the POP server, you are prompted for a password. The password won't be echoed (for security reasons), and it won't be stored in the minibuffer history either. If you don't know your password then you will need to check with your system administrator to find out what it is. The password you use to log in is often worth trying.
Once af has read the POP folder (which may like some time; network
connections are often slow), it displays the buffer as normal. However,
the buffer containing the folder will have the POP3
minor
mode set. This disallows several af features, notably killing and
yanking messages in the buffer. The reason for this is that the
POP3 protocol was designed to work well with existing mail readers,
and it doesn't have the functionality to cope with af's method of folder
management. (3) One way of working around this is to use a pending folder
(see section Pending Folders).
find-file
).
find-file-read-only
).
find-alternate-file
).
find-file-other-window
).
Visiting a folder means reading its contents into an af buffer so you can process them. Af makes a new buffer for each folder that you visit. We say that this buffer is visiting the folder that it was created to hold. Af constructs the buffer name from the folder name by throwing away the directory, keeping just the name proper. For example, a file named `/home/malc/Mail/af' would get a buffer named `af'. If there is already a buffer with that name, a unique name is constructed by appending `<2>', `<3>', or so on, using the lowest number that makes a name that is not already in use.
Each window's mode line shows the name of the buffer that is being displayed in that window, so you can always tell what buffer you are processing.
The changes you make with af commands are made in the af buffer. They do not take effect in the folder that you visited, or any place permanent, until you save the buffer. Saving the buffer means that af writes the current contents of the buffer into its visited folder. See section Saving Files.
If a buffer contains changes that have not been saved, we say the buffer is modified. This is important because it implies that some changes will be lost if the buffer is not saved. The mode line displays two stars near the left margin to indicate that the buffer is modified.
If the status of one or more messages in a buffer has changed (perhaps they were new before you read the folder), but no other changes have been made, then we say that the buffer is status modified. This is not so important as being modified, but some information will be lost if the buffer is not changed. The mode line displays two plus signs near the left margin to indicate that the buffer is status modified.
To visit a folder, use the command C-x C-f (find-file
).
Follow the command with the name of the folder you wish to visit,
terminated by a RET.
The folder name is read using the minibuffer (see section The Minibuffer), with defaulting and completion in the standard manner (see section File Names). While in the minibuffer, you can abort C-x C-f by typing C-g.
If the specified folder does not exist and could not be created, or cannot be read, then you get an error, with an error message displayed in the echo area.
While af is reading the folder, it reports on how many messages it has
read, usually after every five messages read. You can control how often
af updates the count by setting the variable message-count-update
.
Once the folder has been read, af will print a message like this:
(Read 15 messages)
This confirms that af has successfully read the folder into a buffer. The message may also sometimes look like this:
(Read 15 messages; including 1 with bad headers)
This means that the folder was read successfully, but some of the messages in the folder had mail headers that af couldn't interpret properly. This is not usually critical, but some people prefer to know about errors in their mailboxes.
If the variable first-unread-message
is set to true
; then
af will move point to the first message in the buffer that you haven't
read, if there are any. Otherwise you will begin processing the buffer
with point on the first message.
If you visit a file that is already in af, C-x C-f does not make another copy. It selects the existing buffer containing that file.
What if you want to create a new folder? Just visit it. Af prints `(New File)' in the echo area, but in other respects behaves as if you had visited an existing empty file. If you make any changes and save them, the file is created.
If you visit a file that the operating system won't let you modify, Af
makes the buffer read-only, so that you won't go ahead and make changes
that you'll have trouble saving afterward. You can make the buffer
writable with C-x C-q (toggle-read-only
).
Occasionally you might want to visit a folder as read-only in order to
protect yourself from entering changes accidentally; do so by visiting
the file with the command C-x C-r (find-file-read-only
).
If you accidentally visit the wrong folder (perhaps you mistyped the
file name), use the C-x C-v command (find-alternate-file
)
to visit the file you really wanted. C-x C-v is similar to
C-x C-f, but it kills the current buffer (after first offering to
save it if it is modified).
C-x 4 f (find-file-other-window
) is like C-x C-f
except that the buffer containing the specified file is selected in
another window. The window that was selected before C-x 4 f
continues to show the same buffer it was already showing. If this
command is used when only one window is being displayed, that window is
split in two, with one window showing the same buffer as before, and the
other one showing the newly requested file. See section Multiple Windows.
If you are reading mail via POP3, you may prefer to store your
mail on your local machine, rather than on a POP server. You can
do this conveniently with af by using a pending folder, a folder
which contains two folders. The simplest way of doing this is to set
the variable pending-folder
to the name of the folder where all
your incoming mail should be stored; say `+mailbox'. You must set
the pending-folder
variable in your `.afrc' file, or it
will have no affect (see section Variables).
Once the pending-folder
variable is set, it changes the behaviour
of af when you start without specifying folders to read or addresses to
send mail to. Instead of reading your incoming mailbox into its own
buffer, it reads the folder specified in the pending-folder
variable, and then appends the contents of your incoming mailbox to the
buffer.
The buffer is considered to contain both the pending folder and your incoming mailbox; it will be resynchronised from both, and visiting either folder will switch to the buffer displaying the pending folder. When you save the pending folder your incoming mailbox will be cleared, ready for any new mail. If you don't save the buffer, both folders are left untouched.
One advantage of pending folders is that they are normal disk folders. If your incoming mailbox is read via POP3, using a pending folder will allow you to avoid the limitations of buffers in POP3 mode, and use all of af's features in the buffer. Once you've set it up, using a default pending folder is transparent enough that you'll probably never notice the difference.
You can also read a folder into an existing buffer, making the buffer
pending on the folder you read. To do this use the command
M-x read-pending-file. You will be prompted for the name of the
file to make the buffer pending on. This has exactly the same effect
as using the pending-folder
variable.
As we have discussed, buffers are copies of the contents of a folder. So what can we do to handle new mail arriving in the folder after we have read it? The solution to this is resynchronizing the buffer, so that any new messages in the file on disk are incorporated into the buffer.
When a buffer is resynchronised, any new messages are appended to the buffer, and a message will appear in the echo area to let you know that new messages were read into the buffer.
Af will check for new messages whenever you try to save a buffer to disk. If there are new messages then the buffer is resynchronised, and the save will fail.
Af also checks for new mail in each folder you are visiting on a
regular basis. If any buffers are out of date, then they are
resynchronised. How often af does this is controlled by the
resync-time
variable, normally it is done every 600 seconds
(10 minutes).
To manually check for new messages in a buffer's folder, use C-x r
(resync-buffer
). If the buffer needs to be resynchronised, then
point will be set on the first new message.
Saving a buffer in af means writing its contents back into the folder that was visited in the buffer.
save-buffer
).
save-some-buffers
).
not-modified
).
write-file
).
When you wish to save the folder and make your changes permanent, type
C-x C-s (save-buffer
). After saving is finished,
C-x C-s displays a message like this:
(Wrote 12 messages)
If the selected buffer is not modified or status modified (no changes have been made in it since the buffer was created or last saved), saving is not really done, because it would have no effect. Instead, C-x C-s displays a message like this in the echo area:
(No changes need to be written)
The command C-x s (save-some-buffers
) offers to save any
or all modified buffers. It asks you what to do with each buffer.
These questions are also asked if you exit af by typing C-x C-c.
The buffer is automatically resynchronised before being saved, and if
any new messages are found the save will be abandoned.
The command M-x save-all-buffers saves all modified buffers. This can be dangerous if you have several buffers, since you may not want to save one of them, so be careful!
If you have changed a buffer but you do not want to save the changes,
you should take some action to prevent it. Otherwise, each time you use
C-x s or C-x C-c, you are liable to save this buffer by
mistake. One thing you can do is type M-~ (not-modified
),
which clears out the indication that the buffer is modified. If you do
this, none of the save commands will believe that the buffer needs to be
saved. (`~' is often used as a mathematical symbol for `not'; thus
M-~ is `not', metafied.) Alternatively, you can cancel all the
changes made since the file was visited or saved, by reading the text
from the file again. This is called reverting. See section Reverting a Buffer.
If you wish to mark the buffer as visiting a different folder and save
it right away, use C-x C-w (write-file
). It prompts for
the new folder, marks the buffer as visiting that folder, and saves the
buffer. If the folder already exists, af will ask for confirmation that
it is ok to overwrite the file with the buffer.
If you have made extensive changes to a folder and then change your mind about them, you can get rid of them by reading in the previous version of the folder. To do this, use M-x revert-buffer, which operates on the current buffer. Since reverting a buffer unintentionally could lose a lot of work, you must confirm this command with yes.
Reverting marks the buffer as "not modified" until another change is made.
Sometimes you may want to merge two folders. An easy way to do this is
to use C-x i (insert-file
), which inserts the contents of
the specified folder into the buffer at point, leaving mark at the start
of the inserted contents and point after them. The buffer will not be
visiting the folder you inserted, and so will be saved to its original
folder.
The messages you are processing in af reside in an object called a buffer. Each time you visit a folder, a buffer is created to hold the messages in the folder.
At any time, one and only one buffer is selected. It is also called the current buffer. Often we say that a command operates on "the buffer" as if there were only one; but really this means that the command operates on the selected buffer (most commands do).
When af has multiple windows, each window has a chosen buffer which is displayed there, but at any time only one of the windows is selected and its chosen buffer is the selected buffer. Each window's mode line displays the name of the buffer that the window is displaying (see section Multiple Windows).
Each buffer has a name, which can be of any length, and you can select any buffer by giving its name. Most buffers are made by visiting files, and their names are derived from the files' names. But you can also create an empty buffer with any name you want. A newly started af has a buffer named `*scratch*' which can be used as a temporary place to store messages. The distinction between upper and lower case matters in buffer names.
Each buffer records individually what folder it is visiting, whether it is modified, and what major mode and minor modes are in effect in it (see section Major Modes).
switch-to-buffer
).
switch-to-buffer-other-window
).
To select the buffer named bufname, type C-x b bufname
RET. This runs the command switch-to-buffer
with argument
bufname. You can use completion on an abbreviation for the buffer
name you want (see section Completion). An empty argument to C-x b
specifies the most recently selected buffer that is not displayed in any
window.
Most buffers are created by visiting files, but you can also create a buffer explicitly by typing C-x b bufname RET. This makes a new, empty buffer which is not visiting any file, and selects it. If you try and save a buffer created in this way, you are asked for the file name to use.
Note that C-x C-f, and any other command for visiting a file, can also be used to switch to an existing file-visiting buffer. See section Visiting Files.
To display a list of all the buffers that exist, type C-x C-b. Each line in the list shows one buffer's name, major mode and visited file. The buffers are listed in the order, most recently visited first.
`*' or `+' at the beginning of a line indicates the buffer is modified or status modified. If several buffers are modified, it may be time to save some with C-x s (see section Saving Files). `%' indicates a read-only buffer. `.' marks the selected buffer. Here is an example of a buffer list:
MR Buffer Size Mode File -- ------ ---- ---- ---- .* malc 12 Mail /var/spool/mail/malc + af 21 Mail /home/malc/Mail/af *scratch* 0 Mail
If you continue an af session for a while, you may accumulate a large number of buffers. You may then find it convenient to kill the buffers you no longer need. On most operating systems, killing a buffer releases its space back to the operating system so that other programs can use it. Here are some commands for killing buffers:
kill-buffer
).
C-x k (kill-buffer
) kills one buffer, whose name you
specify in the minibuffer. The default, used if you type just RET
in the minibuffer, is to kill the current buffer. If you kill the
current buffer, another buffer is selected; one that has been selected
recently but does not appear in any window now. If you ask to kill a
file-visiting buffer that is modified, then you must confirm with
yes before the buffer is killed.
The command M-x kill-some-buffers asks about each buffer, one by
one. An answer of y means to kill the buffer. Killing the
current buffer or a buffer containing unsaved changes selects a new
buffer or asks for confirmation just like kill-buffer
.
Af can split the screen into two or many windows. Multiple windows can display parts of different buffers, or different parts of one buffer.
Each Af window displays one Af buffer at any time. A single buffer may appear in more than one window; if it does, any changes in its text are displayed in all the windows where it appears. But the windows showing the same buffer can show different parts of it, because each window has its own value of point.
At any time, one of the windows is the selected window; the buffer this window is displaying is the current buffer. The arrow cursor shows the location of point in this window, but is not visible in any other window.
Commands to move point affect the value of point for the selected af window only. They do not change the value of point in any other af window, even one showing the same buffer. The same is true for commands such as C-x b to change the selected buffer in the selected window; they do not affect other windows at all. However, there are other commands such as C-x 4 b that select a different window and switch buffers in it.
When multiple windows show the same buffer, they can have different regions, because they can have different values of point and mark.
Each window has its own mode line, which displays the buffer name, modification status, size in messages, and major and minor modes of the buffer that is displayed in the window. See section The Mode Line, for full details on the mode line.
split-window-vertically
).
other-window
). That is o,
not zero.
scroll-other-window
).
The command C-x 2 (split-window-vertically
) breaks the
selected window into two windows, one above the other. Both windows
start out displaying the same buffer, with the same value of point. By
default the two windows each get half the height of the window that was
split; a numeric argument specifies how many lines to give to the top
window.
To select a different window, type C-x o (other-window
).
That is an o, for `other', not a zero. When there are more than
two windows, this command moves through all the windows from top to
bottom. After the bottommost window, it goes back to the one at the
top. A numeric argument means to move several steps in the cyclic order
of windows. A negative argument moves around the cycle in the opposite
order.
You can also select a different window with M-x previous window. When there are more than two windows, this command moves through all the windows from bottom to top. After the topmost window, it goes back to the one at the bottom. A numeric argument means to move several steps in the cyclic order of windows. A negative argument moves around the cycle in the opposite order.
The usual scrolling commands (see section Scrolling) apply to the selected
window only, but there is one command to scroll the next window.
C-M-v (scroll-other-window
) scrolls the window that
C-x o would select. It takes arguments, positive and negative,
like C-v.
delete-window
). That is a zero.
delete-other-windows
).
enlarge-window
).
To delete a window, type C-x 0 (delete-window
). (That is a
zero.) The space occupied by the deleted window is given to an adjacent
window. Once a window is deleted, its attributes are forgotten; only
restoring a window configuration can bring it back. Deleting the window
has no effect on the buffer it used to display; the buffer continues to
exist, and you can select it in any window with C-x b.
C-x 1 (delete-other-windows
) is more powerful than C-x
0; it deletes all the windows except the selected one; the selected
window expands to use the whole screen except for the echo area.
To readjust the division of space among vertically adjacent windows, use
C-x ^ (enlarge-window
). It makes the currently selected
window get one line bigger, or as many lines as is specified with a
numeric argument. With a negative argument, it makes the selected
window smaller. The extra screen space given to a window comes from one
of its neighbors. You cannot enlarge the window if it would make a
neighbouring window less than two lines tall.
You can also readjust the size of the selected window with M-x shrink-window. It makes the currently selected window get one line smaller, or as many lines as is specified with a numeric argument. With a negative argument, it makes the selected window bigger. The extra screen space released by a window is given to of its neighbors. You cannot shrink the window if it would make the window less than two lines tall.
This chapter talks about various topics relevant to adapting the behavior of af in minor ways. All kinds of customisation affect only the particular af session that you do them in. They are completely lost when you kill af, and have no effect on other af sessions you may run later. The only way an af session can affect anything outside of it is by writing a file; in particular, the only way to make a customisation `permanent' is to put something in your `.afrc' file to do the customisation in each session. (see section The Startup File, `~/.afrc').
You can easily customise af in several different ways:
When af is started, it normally loads an afl program from the file `.afrc' in your home directory. We call this file your Startup file because it is read when you start af. You can use the command line switches `-n' and `-l' to tell af whether to load a startup file, and which one (see section Entering and Exiting Af).
Your site may also have a global startup file; this is named `afrc.afl', if it exists. The af distribution contains no such library; your site may create one for local customisations. If this library exists, it is loaded whenever you start af; and then your own startup file, if any, is loaded.
By far the simplest way to create a startup file is for af to write one for you. The command M-x write-configuration will prompt you for a file name (defaulting to `~/.afrc'), and then write an afl program into that file. When you run that program (by loading the file), it will recreate any changed variables or key bindings, or any new keymaps or named keyboard macros that were in existence when you ran M-x write-configuration.
You can use M-x write-configuration to create a startup file, and then modify that file with an editor; it is a text file. This is also a good way to become familiar with afl.
Af can be programmed to emulate (more or less) several other mail readers. The commands to do this are stored in several afl libraries (see section Afl). Note that the only way to turn an emulation off once you've loaded it is to exit af and start again.
The emulations aren't in any way intended to be true emulations of the mail readers. The intent is to let people who are already used to some other mail reader get started with af quickly, by making most of the common keys do what they expect.
To set up af to work like another mail reader there must be an emulation
library for the mail reader. To load the library for (as an example)
elm
, type type M-x load-library RET elm RET.
The available emulations are:
elm
elm
.
mush
mush
started.
pine
ream
ream
will
probably find this emulation helpful.
vm
VM
emulator is quite different
from af's normal personality. If you've been using the VM
package under Emacs to read mail, then this library may help.
Af presents two interfaces to its variables: The underlying system which is used by Afl (see section Afl), or a simpler system which af uses to allow users to handle configuration variables.
A variable is a symbol which has a value. The symbol's name is also called the name of the variable. Variable names usually consist of words separated by hyphens. Af's configuration variables can each hold a specified kind of value. Sometimes this is a simple type such as a number, or a string, but sometimes a variable will require a more complex value, such as the formats for the screen display.
To examine the value of a single configuration variable, use C-h v
(describe-variable
), which reads a variable name using the
minibuffer, with completion. It displays both the value of and the
documentation for the variable. If you want to see the values of all
the configuration variables, then use C-h C-v
(list-variables
), which lists all the configuration variables and
their values to typeout.
The most convenient way to set a specific variable is with C-x a
(set-variable
). This reads the variable name with the minibuffer
(with completion), and then reads a new value using the minibuffer a
second time. For example,
C-x a ask-cc RET true RET
sets ask-cc
to true.
Whenever you use C-x a, the value of the variable will be checked when you enter it. You can't break af by changing variables, although you can make it behave very strangely if you set some variables to odd values.
When a variable's description says that it contains a list of items, then C-x a will expect the items in the list to be separated by colons. If you set the variable by afl of course, then you would use a list object as the value (see section Afl). For example
C-x a viewable-charsets RET us-ascii:iso-8859-1 RET
set the value of viewable-charsets
to the list containing
`us-ascii' and `iso-8859-1'.
It is usually worth using C-h v (describe-variable
) to
check the on-line help for a variable you intend to change; often the
description is far more detailed than is given in this manual.
A keyboard macro is a command defined by the user to stand for another sequence of keys. For example, if you discover that you are about to type C-t t a RET C-n forty times, you can speed your work by defining a keyboard macro to do C-t t a RET C-n and calling it with a repeat count of forty.
start-kbd-macro
).
end-kbd-macro
).
call-last-kbd-macro
).
kbd-macro-query
).
Keyboard macros differ from ordinary af commands in that they are written in the af command language rather than in C or afl. This makes it easier for the novice to write them, and makes them more convenient as temporary hacks. However, the af command language is not powerful enough as a programming language to be useful for writing anything intelligent or general (Neither is afl yet, but that will change).
You define a keyboard macro while executing the commands which are the definition. Put differently, as you define a keyboard macro, the definition is being executed for the first time. This way, you can see what the effects of your commands are, so that you don't have to figure them out in your head. When you are finished, the keyboard macro is defined and also has been, in effect, executed once. You can then do the whole thing over again by invoking the macro.
To start defining a keyboard macro, type the C-x ( command
(start-kbd-macro
). From then on, your keys continue to be
executed, but also become part of the definition of the macro.
`Def' appears in the mode line to remind you of what is going on.
When you are finished, the C-x ) command (end-kbd-macro
)
terminates the definition (without becoming part of it!). For example,
C-x ( M-+ +foobar RET C-n C-x )
defines a macro to save the current message to the folder `+foobar', and then move down a line.
The macro thus defined can be invoked again with the C-x e command
(call-last-kbd-macro
), which may be given a repeat count as a
numeric argument to execute the macro many times. C-x ) can also
be given a repeat count as an argument, in which case it repeats the
macro that many times right after defining it, but defining the macro
counts as the first repetition (since it is executed as you define it).
Therefore, giving C-x ) an argument of 4 executes the macro
immediately 3 additional times. An argument of zero to C-x e or
C-x ) means repeat the macro indefinitely (until it gets an error
or you type C-g).
If you wish to repeat an operation at regularly spaced places in the text, define a macro and include as part of the macro the commands to move to the next place you want to use it. For example, if you want to change each line, you should position point at the start of a line, and define a macro to change that line and leave point at the start of the next line. Then repeating the macro will operate on successive lines.
After you have terminated the definition of a keyboard macro, you can add to the end of its definition by typing C-u C-x (. This is equivalent to plain C-x ( followed by retyping the whole definition so far. As a consequence it re-executes the macro as previously defined.
If you wish to save a keyboard macro for longer than until you define
the next one, you must give it a name using M-x name-last-kbd-macro.
This reads a name as an argument using the minibuffer and defines that
name to execute the macro. Defining the macro in this way makes it a
valid command name for calling with M-x or for binding a key to
with global-set-key
(see section Keymaps). If you specify a name
that has a prior definition other than another keyboard macro, an error
message is printed and nothing is changed.
Using C-x q (kbd-macro-query
), you can make a macro ask
you each time around whether to make a change. While defining the
macro, type C-x q at the point where you want the query to occur.
During macro definition, the C-x q does nothing, but when you run
the macro later, C-x q asks you interactively whether to continue.
The valid responses are SPC to continue, and RET to skip the rest of this repetition of the macro and start right away with the next repetition. ESC means to skip the rest of this repetition and cancel further repetitions. C-l redraws the screen and asks you again for a character to say what to do.
This section describes key bindings which map keys to commands, and the keymaps which record key bindings. It also explains how to customise key bindings.
The bindings between key sequences and command functions are recorded in data structures called keymaps. Af has many of these, each used on particular occasions.
Recall that a key sequence (key, for short) is a sequence of key presses that have a meaning as a unit. A key sequence gets its meaning from its binding, which says what command it runs. The function of keymaps is to record these bindings.
The global keymap is the most important keymap because it is always in effect. The global keymap defines keys which are common to most or all of the major modes. Each major mode has its own keymap which overrides the global definitions of some keys.
For example, the key C-n move to the next line because the global
keymap binds it to the command next-line
. Commands to rebind
keys, such as M-x global-set-key, actually work by storing the new
binding in the proper place in the keymaps. See section Changing Key Bindings Interactively.
Meta characters work differently; af translates each Meta character into a pair of characters starting with ESC. When you type the character M-r in a key sequence, af replaces it with ESC r. A meta key comes in as a single key press, but becomes two events for purposes of key bindings. The reason for this is historical; most older terminals didn't support a meta key.
A keymap records definitions for single characters. Interpreting a key sequence of multiple characters involves a chain of keymaps. The first keymap gives a definition for the first character; this definition is another keymap, which is used to look up the second character in the sequence, and so on.
You can find out what keymaps are defined in af with the command M-x list-keymaps. This lists the keymaps, with the prefix keys they handle, to typeout.
A prefix key such as C-x or ESC has its own keymap, which holds the definition for the character that immediately follows that prefix.
The definition of a prefix key is usually the keymap to use for looking
up the following event. Thus, the binding of C-x is the keymap
control-x-prefix
, the keymap for C-x commands. The
definitions of C-c, C-t, C-x, C-h and ESC
as prefix keys appear in the global map, so these prefix keys are always
available.
The C-c prefix has been assigned as a "user prefix". By default, nothing will be bound in the C-c keymap; it is reserved for your own key bindings. There is a separate C-c prefix keymap for each of af's major modes. See section Local Keymaps.
So far we have explained the ins and outs of the global map. Major
modes customise af by providing their own key bindings in
local keymaps. For example, minibuffer mode overrides the
printable characters to bind them to the command
self-insert-command
, so that the characters insert themselves
into the minibuffer at point.
A local keymap can locally redefine a key as a prefix key by defining it as a prefix keymap. If the key is also defined globally as a prefix, then its local and global definitions (both keymaps) effectively combine: both of them are used to look up the character that follows the prefix key. Thus, if the mode's local keymap defines C-x as another keymap, and that keymap defines C-z as a command, this provides a local meaning for C-x C-z. This does not affect other sequences that start with C-x; if those sequences don't have their own local bindings, their global bindings remain in effect.
Another way to think of this is that af handles a multi-event key sequence by looking in several keymaps, one by one, for a binding of the whole key sequence. First it checks the minor mode keymaps for minor modes that are enabled, then it checks the major mode's keymap, and then it checks the global keymap. This is not precisely how key lookup works, but it's good enough for understanding ordinary circumstances.
Designing af keymaps is made more complicated because several commands will only work in one or two of the major modes. You should be careful using global bindings; local bindings will usually achieve what you want, and are less confusing to work with.
The way to redefine an af key is to change its entry in a keymap. You can change the global keymap, in which case the change is effective in all major modes (except those that have their own overriding local definitions for the same key). Or you can change the current buffer's local map, which affects all buffers using the same major mode.
For example, suppose you like to execute commands in a subshell, instead
of suspending af and executing commands in your login shell. Normally,
C-z is bound to the function suspend-af
, but you can change
C-z to invoke a subshell by binding it to shell
as
follows:
M-x global-set-key RET C-z shell RET
global-set-key
reads the command name after the key. After you
press the key, a message like this appears so that you can confirm that
you are binding the key you want:
Set key C-z to command:
You can rebind a key that contains more than one character in the same way. Af keeps reading the key to rebind until it is a complete key (that is, not a prefix key). Thus, if you type C-f for key, that's the end; the minibuffer is entered immediately to read cmd. But if you type C-x, another character is read; if that is 4, another character is read, and so on. For example,
M-x global-set-key RET C-x 4 $ scroll-other-window RET
redefines C-x 4 $ to run the command scroll-other-window.
The commands typeout-set-key
and minibuffer-set-key
are
a convenience; they bind keys in the typeout or minibuffer keymaps
rather than the global or local maps.
You can remove the global definition of a key with
global-unset-key
. This makes the key undefined; if you
type it, af will just beep. Similarly, local-unset-key
makes a
key undefined in the current major mode keymap, which makes the global
definition (or lack of one) come back into effect in that major mode.
If you have redefined (or undefined) a key and you subsequently wish to retract the change, undefining the key will not do the job--you need to redefine the key with its standard definition. The documentation of keys in this manual also lists their command names.
If you want to define a new prefix key, you will need to create a new keymap to handle the prefix key. To do this, use the command M-x make-keymap, which will prompt you for the name of the keymap to create. If you specify a name that already has a definition an error message is printed and nothing is changed.
There are two variables which can be important when you are binding
keys. The variable meta-prefix-char
names the character which is
used as a prefix when you type a metacharacter at the keyboard. If you
change the binding of ESC, then you should change the value of
meta-prefix-char
to reflect this. Similarly, the variable
quit-char
names the character which is used to quit from confirm
prompts, and similar; so it should probably reflect the usual binding
of keyboard-quit
in the keymaps.
Afl is the af extension language, a simple programming language which allows you to write files containing af commands. Afl is similar to the Lisp programming language, so Lisp programmers should find afl easy to learn. Afl should be simple enough that it is easy for other programmers to learn.
Afl is designed for programmers to use, although once a programmer has written an afl program anyone should be able to use that program.
Afl programs are made up of one or more afl objects; pieces of data used and manipulated by afl programs. For our purposes, a type or data type is a set of possible objects.
When you run an afl program, the afl reader is called to read the textual representations of the afl objects in the program, and convert them to actual afl objects. If you try to display an object, the afl printer is called to generate a printed representation of the object.
The evaluation of expressions in afl is performed by the afl interpreter; a program that receives an afl object as input and computes its value as an expression. How it does this depends on the data type of the object. An afl object that is intended for evaluation is called an expression or a form.
The most useful type of afl object to evaluate is lists. When you evaluate an afl list, the head of the list is evaluated as a function, and then the remaining items in the list are passed as arguments to the function. Arguments are always evaluated in left-to-right order, although there are a few functions, known as special forms, which may not evaluate all of their arguments. These functions' handling of arguments will be explained in the function's description.
Each data type in afl has a read syntax and a printed representation. The read syntax is the way the data type should be written in an afl program. The printed representation is the way that the data type will be displayed by the afl printer. These may be the same or different.
A comment is text that is written in a program only for the sake of humans that read the program, and that has no effect on the meaning of the program. In afl, a semicolon (`;') starts a comment if it is not within a string or character constant. The comment continues to the end of line. The afl reader discards comments; they do not become part of the afl objects which represent the program.
In afl, the symbol nil
is overloaded with three meanings: it
is a symbol with the name `nil'; it is the logical truth value
false; and it is the empty list--the list of zero elements.
When used as a variable, nil
always has the value nil
.
As far as the afl reader is concerned, `()' and `nil' are
identical: they stand for the same object, the symbol nil
. The
different ways of writing the symbol are intended entirely for human
readers. After the afl reader has read either `()' or `nil',
there is no way to determine which representation was actually written
by the programmer.
In contexts where a truth value is expected, any non-nil
value
is considered to be true. However, t
is the preferred way
to represent the truth value true. When you need to choose a
value which represents true, and there is no other basis for
choosing, use t
. The symbol t
always has value t
.
For convenience, the constant a
is defined to be the value
`ask' or `accept' in af's tristate configuration variables.
This is the preferred way to set, for example, the variable
copy-on-reply
to `ask'.
In afl, nil
, t
and a
, are special symbols that
always evaluate to themselves. This is so that you do not need to quote
them to use them as constants in a program. An attempt to change their
values results in an error.
A list of objects of any data type (including lists). A list is read or printed as a set of objects enclosed in parentheses; for example `(a b c)', or `(a b (c d e) f)'.
Lists are evaluated by evaluating the symbol at their head as a function. The remaining objects are evaluated (unless the function is a special form), and passed as arguments to the function.
Af only supports integer numbers. A number is read or printed as an optional sign, followed by one or more digits; for example `42', or `-999'.
There is a system-defined limit to the maximum value of a number, usually 32 bits. Larger values will be truncated to fit within these bounds, which will leave them with unexpected values.
Numbers always evaluate to themselves.
In afl, characters are interchangeable with numbers, and are always printed as a number. They can be read either as a number, or as a question mark followed by the character; for example `?a'. If the character is not a normal alphanumeric one, then it is often necessary to prefix it with a backslash '\' to make sure it is treated as a character. If the character is '\' then you need a second '\' to quote it; for example. `?\\'.
You can write the characters Control-g, backspace, tab, newline, vertical tab, formfeed, return, and escape as `?\a', `?\b', `?\t', `?\n', `?\v', `?\f', `?\r', and `?\e', respectively.
Rather than quoting a control character with `\', another read syntax may be used. If a character is a backslash followed by a caret and another non-control character, then it represents the control character. For example, `?\^I' is read syntax for the character C-i. You may also use `C-' rather than `^', so `\C-i' is also read syntax for C-i.
A meta character is one that has the top bit set, and can be typed with a meta key on some keyboards. Read syntax for metacharacters is `?\M-' followed by the character. This may be combined with control character read sequence, hence `?\C-\M-i' is read syntax for C-M-i.
Finally, the most general read syntax for characters is a question mark followed by a backslash and the numeric value of the character in octal (up to three digits are allowed). So `?\001' is read syntax for the character C-a.
An invalid control or meta character sequence (such as `?\C-\^a' or `?\C-1') will be flagged as an error by the afl reader.
As with numbers, there is a system-defined limit to the maximum value of a character, usually 8 bits. Larger values will be truncated to fit within these bounds, which will leave them with unexpected values.
Characters always evaluate to themselves.
The read syntax and printed representation of afl strings is the string enclosed in double quotes; for example `"A string"'. All the special ways of writing characters can be used within strings. In addition, a backslash followed by a newline is ignored within a string, so strings can be broken to fit on the screen better; for example:
"This string is broken here \ by a \\\\n sequence"
would be read as `This string is broken here by a \\n sequence'.
Strings always evaluate to themselves.
A symbol name can contain any characters you require. Any use of the characters `'"();?.,\ \t\n' should be quoted with a `\' character. If the symbol name looks like a number, then it can be prefixed with a `\' to force it to be treated as a symbol. Note that unlike its use in strings, the `\' simply quotes the next character in the symbol name.
Evaluating a symbol works differently according to the context in which the symbol is being evaluated. An afl symbol can store a variable or a function, or both. The afl evaluator will usually look up the value of the symbol as a variable, but will use the value as a function if the symbol is at the head of a list.
Afl has several primitive functions, which are predefined in af, and can be called from your afl programs. In addition, an afl program can call any af command as a function; af commands are simply functions that have made provision for interactive use.
The appearance of the keyword &optional
in the parameter list of
a function indicates that the arguments for subsequent parameters may be
omitted (omitted parameters default to nil
). Do not write
&optional
when you call the function.
The keyword &rest
(which will always be followed by a single
parameter) indicates that any number of arguments can follow. The value
of the single following parameter will be a list of all these arguments.
Do not write &rest
when you call the function.
(quote form)
Sometimes, you may not want a form to be evaluated, for example the name
of a symbol to assign a value to with set
. You can prevent a
form from being evaluated by using the special form quote
. So
(quote list-functions)
expands to the symbol
list-functions
.
Because quote
is used so often, there is a special notation for
it. Writing 'form
is equivalent to writing (quote
form)
. So 'list-functions
is equivalent to the example
above.
(if condition then &optional else)
(progn &rest forms)
(equal object1 object2)
t
if object1 and object2 have the same afl
type and contents, nil
otherwise.
(and &rest conditions)
nil
.
Returns the value of the last condition evaluated.
(or &rest conditions)
(not condition)
t
if condition evaluates to nil
, nil
otherwise.
To evaluate code only if a condition is true, use
(if condition true false)
. This evaluates
condition, and then evaluates true if condition
returned non-nil, or false (if specified) otherwise.
You can use progn
to group a set of forms, for example to use in
an if
. progn
evaluates its arguments from left-to-right,
and returns the value returned by the last argument.
You can compare the value of two afl objects with equal
. This
will return t
if the two objects have the same afl type and
contents, or nil
otherwise.
To combine one or more logical expressions, you can use and
,
or
, and not
. The special form and
evaluates its
arguments from left to right until one of them returns nil
, and
then returns nil
; the remaining arguments are never evaluated.
If no argument returns nil
, then the value returned by the last
argument evaluated is returned.
The special form or
is more-or-less the opposite of and
;
it evaluates its arguments from left to right until one of them returns
non-nil, and then returns the value the argument returned; the remaining
forms are never evaluated. If no argument evaluates to non-nil, then
or
returns nil
.
To reverse a test use not
. This returns t
if the argument
evaluates to nil
, or nil
otherwise.
(set symbol value)
(setq symbol value)
(set 'symbol value)
.
(define-key keymap "key" value)
(define-kbd-macro macro "keys")
To set an af configuration variable, use the function set
. This
sets the variable to the value supplied. The value will be checked to
make sure that it is a valid value for the variable.
Since set
is a function you will need to quote the symbol to be
set. For convenience, the special form setq
is equivalent to
set
, but does not evaluate the object which is to be set.
So (setq ask-cc t)
is equivalent to (set 'ask-cc t)
.
To bind a key in a keymap use (define-key keymap "key"
object)
. This binds key in keymap keymap to
object, which must be a command, a keymap, a keyboard macro, or
nil
. To find the name of the keymap you want to bind the key in
use the list-keymaps
command. Since define-key
is a
function you will need to quote keymap and object.
To define a new keyboard macro, or redefine an existing one, use the
function (define-kbd-macro macro "keys")
. This
defines macro to execute keys. Since
define-kbd-macro
is a function you will need to quote
macro.
(message &rest forms)
(error &rest forms)
(getenv "name")
nil
if name is not set in the environment.
The functions message
and error
display messages or error
messages in the echo area. While message
returns the forms that
it printed, error
returns an error condition, which will halt the]
execution of the afl program.
You can extract values from the environment by using
(getenv "variable")
, which looks up and returns the
definition of variable in the environment. This can be very
useful for terminal-dependent customisation of af.
Once you have created a file containing af commands (known as an afl program or afl library, you can load it. When you load an afl program, the file is opened, and its contents are passed to the afl reader. Once all the file has been read and evaluated, then the file is closed. If any form in the file is invalid, or produces an error, then the afl reader will abort, and the file will be closed.
The simplest way to load an afl program is to use the the command
load-file
, which loads a named file. You must specify the full
name of the file.
The load-library
command will search for an afl program in a
set of directories defined by the load-path
variable. It checks
for the file name with `.afl' appended, as well as the filename
alone.
If you want to modify where af looks for library files, there are two
ways to do so. You can set the environment variable AFLOADPATH
to a colon-separated list of directories to search; or you can set the
configuration variable load-path
to the same value. For example:
(setq load-path '("/usr/lib/af" "/usr/local/lib/af"))
would make af look for afl libraries in the directories `/usr/lib/af' and `/usr/local/lib/af'.
Here are a few examples of afl code, with brief explanations.
Load the library `ansi.afl' if you are using an ANSI terminal (under one of several common names):
(if (or (equal (getenv "TERM") "ansi") (equal (getenv "TERM") "xterm") (equal (getenv "TERM") "vt100")) (load-library "ansi"))
Set the viewable-charsets
variable to allow displaying the
iso-8859-1
character set if running on an xterm:
(if (equal (getenv "TERM") "xterm") (setq viewable-charsets '("iso-8859-1" "us-ascii")))
Complain if the user isn't running on an xterm:
(if (not (equal (getenv "TERM") "xterm")) (error "Must be running on an xterm"))
Define a keyboard macro to move to the next message from typeout:
(define-kbd-macro 'typeout-next-message "\C-g\C-n\r")
Bind the above macro to the key M-n in the typeout maps:
(define-key 'typeout-prefix-command "n" 'typeout-next-message)
next-line
. See section Keymaps.
load-path
holds a search path for finding afl library files. See section Afl.
a
(afl)
nil
(afl)
t
(afl)
Don't worry if you don't understand this; you don't need to know about these things to use af
If you edit your `.afalias' file, you will find that the old version of the alias will be commented out rather than deleted when you change it. This can be useful if you accidentally overwrite an important alias.
This isn't really POP3's fault; the design of af and of other mailers is very different in several areas. The IMAP protocol provides all the functionality that af needs to work normally, but since it is nothing like as widely supported as POP3, we decided that POP3 was the network protocol to support. For now.
This document was generated on 3 April 1998 using the texi2html translator version 1.51.