mh-e. Node: Searching

PREV Moving Mail UP Using mh-e NEXT Sequences

2.5: Searching Through Messages

You can search a folder for messages to or from a particular person or about a particular subject. In fact, you can also search for messages containing selected strings in any arbitrary header field or any string found within the messages. Use the M-s (mh-search-folder) command. You are first prompted for the name of the folder to search and then placed in the following buffer in MH-Pick mode:

From: # To: Cc: Date: Subject: -------- --**-Emacs: pick-pattern (MH-Pick)------All----------------------------

Pick window

Edit this template by entering your search criteria in an appropriate header field that is already there, or create a new field yourself. If the string you're looking for could be anywhere in a message, then place the string underneath the row of dashes. The M-s command uses the MH command pick to do the real work, so read pick(1) to find out more about how to enter the criteria.

There are no semantics associated with the search criteria---they are simply treated as strings. Case is ignored when all lowercase is used, and regular expressions (a la ed) are available. It is all right to specify several search criteria. What happens then is that a logical and of the various fields is performed. If you prefer a logical or operation, run M-s multiple times.

As an example, let's say that we want to find messages from Ginnean about horseback riding in the Kosciusko National Park (Australia) during January, 1994. Normally we would start with a broad search and narrow it down if necessary to produce a manageable amount of data, but we'll cut to the chase and create a fairly restrictive set of criteria as follows:

From: ginnean
To:
Cc:
Date: Jan 1994
Subject: horse.*kosciusko
--------

As with MH-Letter mode, MH-Pick provides commands like C-c C-f C-t to help you fill in the blanks.

C-c C-f C-t

Move to `To:' header field (mh-to-field).

C-c C-f C-c

Move to `cc:' header field (mh-to-field).

C-c C-f C-s

Move to `Subject:' header field (mh-to-field).

C-c C-f C-f

Move to `From:' header field (mh-to-field).

C-c C-f C-b

Move to `Bcc:' header field (mh-to-field).

C-c C-f C-f

Move to `Fcc:' header field (mh-to-field).

C-c C-f C-d

Move to `Dcc:' header field (mh-to-field).

C-c C-c

Execute the search (mh-do-pick-search).

To perform the search, type C-c C-c (mh-do-pick-search). The selected messages are placed in the search sequence, which you can use later in forwarding (see Forwarding), printing (see Printing), or narrowing your field of view (see Sequences). Subsequent searches are appended to the search sequence. If, however, you wish to start with a clean slate, first delete the search sequence (how to do this is discussed in Sequences).

If you're searching in a folder that is already displayed in a MH-Folder buffer, only those messages contained in the buffer are used for the search. Therefore, if you want to search in all messages, first kill the folder's buffer with C-x k or scan the entire folder with M-r.

PREV Moving Mail UP Using mh-e NEXT Sequences