Next: Extending, Previous: Setting up the mairix interface, Up: Top [Contents]

## 4 Using mairix.el

There are currently no default key bindings for mairix.el, since those should depend on the used mail program and I personally do not use RMail, so I wouldn’t know which key bindings are reasonable. I hope some day this will change and `mairix.el` will come with some good key bindings for the different mail programs. Feel free to send me your suggestions. Until then, define some bindings yourself. Here’s a quick and dirty solution with global key definitions I currently use, which might or might not collide with some other modes. Simply include them in your `.emacs` and adapt to your needs:

    (global-set-key (kbd "C-c C-o m") 'mairix-search)
    (global-set-key (kbd "C-c C-o w") 'mairix-widget-search)
    (global-set-key (kbd "C-c C-o u") 'mairix-update-database)
    (global-set-key (kbd "C-c C-o f") 'mairix-search-from-this-article)
    (global-set-key (kbd "C-c C-o t") 'mairix-search-thread-this-article)
    (global-set-key (kbd "C-c C-o b") 'mairix-widget-search-based-on-article)
    (global-set-key (kbd "C-c C-o s") 'mairix-save-search)
    (global-set-key (kbd "C-c C-o i") 'mairix-use-saved-search)
    (global-set-key (kbd "C-c C-o e") 'mairix-edit-saved-searches)

Here’s a description of the available interactive functions:

`mairix-search`

  Call mairix with a search query. You will also be asked if you want to include whole threads. The results are saved by mairix in the default mail file, which is set through the variable `mairix-search-file`, which again is prefixed by `mairix-file-path`. The results will then be displayed with the chosen mail program. The command used to call mairix is specified by the variable `mairix-command`, together with the options `mairix-search-options`. The latter has the default `-F` for making searching faster.

`mairix-widget-search`

  Creates a mairix query using graphical widgets. Very handy if you’re not (yet) familiar with the mairix search syntax. Just call it to see how it works. You can then directly call mairix with the search term or save it for future use. Since mairix allows almost arbitrary combinations of search commands (like “tc” for “to or cc”), you might want to include some other fields. This can be easily done by modifying `mairix-widget-fields-list`.

`mairix-widget-search-based-on-article`

  Create a mairix query using graphical widgets, but based on the currently displayed article, i.e., the available fields will be filled with the current header values.

`mairix-search-from-this-article`

  Search messages from sender of the current article. This is effectively a shortcut for calling `mairix-search` with `f:current_from`. If used with a prefix, include whole threads of the found messages.

`mairix-search-thread-this-article`

  Search thread for the current article. This is effectively a shortcut for calling `mairix-search` with `m:msgid` of the current article and enabled threads.

`mairix-save-search`

  Save the last search for future use. You will have to specify a name for the search and will then be asked if you want to save your saved searches in your `.emacs`. If you answer with yes, the variable `mairix-saved-searches` will be saved in the customize section of your `.emacs`. You can also do this later by using `mairix-edit-saved-searches`.

`mairix-use-saved-search`

  Call mairix with a previously saved search. You will be asked for the name of the saved search (use `TAB` for completion).

`mairix-edit-saved-searches`

  Edit your current mairix searches. This is a simple major mode for editing the contents of the variable `mairix-saved-searches`. You can edit and delete searches and save them in your `.emacs`. You can also use this mode to call mairix with one of the saved searches. Additionally, you can specify a file name for mairix to use for a certain search instead of the default one. This is useful if you want to open different searches at the same time, or if you want to regularly access certain searches without the need to call mairix.

`mairix-edit-saved-searches-customize`

  Edit the variable `mairix-saved-searches` in a normal customization buffer. This function exists more or less for historic reasons, but maybe you like it.

`mairix-update-database`

  Call mairix to update the database. Mairix will be called with the options `mairix-update-options`; the default is `-F` and `-Q` to make updates as fast as possible. Note that by using these options, absolutely no integrity checking is done. If your database somehow gets corrupted, simply delete it and update. If `mairix-synchronous-update` is `nil` (the default), mairix will be called in a subprocess so Emacs will still be usable while the update is done.

Next: Extending, Previous: Setting up the mairix interface, Up: Top [Contents]