[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13. Tags

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.

13.1 Tag Concepts  An introduction to af's tags.
13.2 Setting and Removing Tags  How to set and remove tags.
13.3 Using Tags  How you can process tagged messages.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1 Tag Concepts

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.

13.1.1 System Tags  Tags which reflect a message's status.
13.1.2 User Tags  Tags which you can set and unset yourself.
13.1.3 Tag Lists  Format of lists of tags to (un)set.
13.1.4 Tag Expressions  Expressions you can use to select messages.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1.1 System Tags

The system tags are all upper-case letters, which give information on the status of messages. The possible system tags are:

`D'
The message has been marked for deletion with M-x delete-message.
`E'
Af found an error in the message's headers when the folder was visited. This is not normally critical, but you may not be able to reply to the message; or it may even (rarely) indicate a corrupted folder.
`F'
You have forwarded or bounced the message (see section 8. Composing and Sending Mail).
`M'
The message is in MIME format; and isn't text that you can display on your terminal. When you read the message, af will display each body part separately if there are more that one, and will use external commands to display any non-textual body parts. If af doesn't know how to display a given body part then it will ask you what to do.
`T'
The message is in MIME format, and is textual, but is either not plain text, or is in a character set not listed in the viewable-charsets variable. When you read the message then it will be displayed as usual, which may not be ideal.
`N'
The message is new; the message has arrived since last time you visited the folder and hasn't yet been read.
`O'
The message is old but unread. The message was present last time you visited the folder, but you haven't read it yet.
`P'
A hardcopy of the message has been printed to a spooler.
`R'
You have replied to the message (see section 8. Composing and Sending Mail).
`S'
The message has been saved to a folder.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1.2 User Tags

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1.3 Tag Lists

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 (`+').


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1.4 Tag Expressions

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:

`( ... )'
Override any precedence, and force the contents of the parentheses to be evaluated as a unit. `(a)' is equivalent to `a'.
`!'
Logical not; true if the expression it precedes is false. `!a' is true if `a' is not set.
`&'
Logical and; true if both sides of the expression are true. `a & b' is true if both `a' and `b' are set.
`^'
Logical exclusive-or; true if only one side of the expression is true. `a ^ b' is true if either `a' or `b' is set, but not both.
`|'
Logical or; true if either side of the expression is true. `a | b' is true if either `a' or `b' is set, or if both are set.

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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.2 Setting and Removing Tags

C-t t tags RET
Set tags on the current message (tag-message).
C-t u tags RET
Remove tags from the current message (untag-message).
C-t r tags RET
Remove tags from all the messages in the buffer (remove-tag).
M-x tag-thread tags RET

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 15.3 Tagging Matching Messages.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.3 Using Tags

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:

C-t C-k tag-expr RET
Kill the messages in the tagset defined by tag-expr (kill-tagset). See section 14. Killing and Yanking.
C-t w tag-expr RET
Copy the messages in the tagset into the kill buffer as if they had been killed (copy-tagset-as-kill). See section 14. Killing and Yanking.
C-t + tag-expr RET folder RET
Save the messages in the tagset into folder (save-tagset). This command handles the argument in the same way as M-+ (save-message). See section 11.1 Saving Messages.
C-t p tag-expr RET
Print a hardcopy of all the messages in the tagset (print-tagset). This command handles the argument in the same way as M-p (print-message). See section 11.2 Printing Messages.
C-t | tag-expr RET folder RET
Pipe the messages in the tagset into a single instance of the shell command command (pipe-tagset). Again, this command handles the argument in the same way as M-| (pipe-message) See section 11.3 Piping Messages.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Malc Arnold on August, 22 2002 using texi2html