3 @setfilename ../../info/mairix-el.info
4 @settitle Emacs Interface for Mairix
8 Copyright @copyright{} 2008--2016 Free Software Foundation, Inc.
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.3 or
13 any later version published by the Free Software Foundation; with no
14 Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
15 and with the Back-Cover Texts as in (a) below. A copy of the license
16 is included in the section entitled ``GNU Free Documentation License''.
18 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
19 modify this GNU manual.''
23 @dircategory Emacs network features
25 * Mairix: (mairix-el). Emacs interface to the Mairix mail indexer.
29 @title mairix.el---Mairix interface for Emacs
33 @vskip 0pt plus 1filll
40 @top mairix.el---Mairix interface for Emacs
42 Mairix is a tool for indexing and searching words in locally stored
43 mail. It was written by Richard Curnow and is licensed under the
46 @code{mairix.el} is an interface to the mairix search engine. It allows you to
47 call mairix with a search term, easily create searches based on the
48 currently displayed mail, save regularly used searches in your
49 @file{.emacs} for future use and lets you call mairix for updating the
57 * About:: About the mairix search engine and mairix.el.
58 * Configuring mairix:: How to configure mairix.
59 * Setting up the mairix interface:: Set up mairix.el.
60 * Using:: List of interactive functions
61 * Extending:: Support your favorite mail reader!
62 * GNU Free Documentation License:: The license for this documentation.
66 @chapter About mairix and mairix.el
68 Mairix is a tool for indexing and searching words in locally stored
69 mail. It was written by Richard Curnow and is licensed under the
70 GPL@. Mairix comes with most popular GNU/Linux distributions, but it also
71 runs under Windows (with cygwin), Mac OS X and Solaris. The homepage can
73 @uref{http://www.rpcurnow.force9.co.uk/mairix/index.html}
75 Though mairix might not be as flexible as other search tools like
76 swish++ or namazu, it has the prime advantage of being incredibly fast.
77 On current systems, it can easily search through headers and message
78 bodies of thousands and thousands of mails in well under a second.
79 Building the database necessary for searching might take a minute or
80 two, but only has to be done once fully. Afterwards, the updates are
81 done incrementally and therefore are really fast, too. Additionally,
82 mairix is very easy to set up.
84 Mairix presents the search results by either populating a @emph{virtual}
85 maildir/MH folder with symlinks which point to the ``real'' message
86 files, or if mbox is used, it creates a new mbox file which contains
87 copies of the found messages.
89 @code{mairix.el} is an interface to the mairix search engine. It allows
90 you to call mairix with a search term, easily create searches based on
91 the currently displayed mail, save regularly used searches in your
92 @file{.emacs} for future use and lets you call mairix for updating the
93 database. It also lets you easily create search queries using graphical
94 widgets, similar to a customization buffer.
96 Currently, @code{mairix.el} is only tested with mbox output together
97 with RMail, Gnus, or VM as the Emacs mail program. However, it should
98 also work with Maildir or MH, and it should be very easy to integrate
99 other Emacs mail programs into @code{mairix.el}
102 If you use Gnus with maildir or MH, you should really use the native
103 Gnus back end @code{nnmairix} instead, since it is more tightly
104 integrated into Gnus and has more features.
106 @node Configuring mairix
107 @chapter Configuring mairix
109 Setting up mairix is easy: simply create a @file{.mairixrc} file with
110 (at least) the following entries:
113 # Your mail base folder
117 This is the base folder for your mails. All the following directories,
118 except the one for the database, are relative to this base folder.
121 mbox = ... your mbox files which should be indexed ...
122 maildir= ... your maildir folders which should be indexed ...
123 mh= ... your nnml/mh folders which should be indexed ...
126 Specify all your maildir/nnml folders and mbox files (relative to the
127 base directory!) you want to index with mairix. Use colons to separate
128 different files. See the man-page for @code{mairixrc} for details.
132 database = ... location of database file ...
135 This chooses @code{mbox} as the output format for the mairix search
136 results. Currently, this is the supported format by mairix.el, but
137 technically it should be possible to also use maildir or mh; it's just
140 You should make sure that you don't accidentally index the search
141 results produced by mairix. This can be done by pointing
142 @code{mairix-file-path} to a directory which is surely not indexed by mairix.
143 Another possibility is to use something like
149 in the @file{.mairixrc} file, and prefix every search file you use with
153 database = /home/user/.mairixdatabase
156 This specifies the name of the database file. Note that this is not
157 relative to the @code{base} folder.
159 See the man page for @code{mairixrc} for details and further options,
160 especially regarding wildcard usage, which may be a little different
161 than you are used to.
163 Now simply call @code{mairix} to create the index for the first time.
164 Note that this may take a few minutes, but every following index will do
165 the updates incrementally and hence is very fast.
167 @node Setting up the mairix interface
168 @chapter Setting up the mairix interface
170 First, put @code{mairix.el} in your Emacs search path and put
171 @code{(require 'mairix)} into your @file{.emacs} file. Then, use
172 @kbd{M-x customize-group mairix RET} to set your preferences for
173 mairix.el. The most important items are @emph{Mairix File Path},
174 @emph{Mairix Search File} and @emph{Mairix Mail Program}. The latter
175 specifies which mail program should be used to display the mairix search
176 results. Currently, RMail, Gnus with mbox files, and VM are supported.
177 If you use Gnus with maildir or mh, use the native Gnus back end
180 If you use another Emacs mail program which is not yet supported by
181 mairix.el, it is pretty easy to integrate it. @xref{Extending},
182 on how to integrate it into mairix.el.
184 Now you should be ready to go. @xref{Using}, for the available commands.
187 @chapter Using mairix.el
189 There are currently no default key bindings for mairix.el, since those
190 should depend on the used mail program and I personally do not use
191 RMail, so I wouldn't know which key bindings are reasonable. I hope some
192 day this will change and @code{mairix.el} will come with some good
193 key bindings for the different mail programs. Feel free to send me your
194 suggestions. Until then, define some bindings yourself. Here's a quick
195 and dirty solution with global key definitions I currently use, which
196 might or might not collide with some other modes. Simply include them
197 in your @file{.emacs} and adapt to your needs:
200 (global-set-key (kbd "C-c C-o m") 'mairix-search)
201 (global-set-key (kbd "C-c C-o w") 'mairix-widget-search)
202 (global-set-key (kbd "C-c C-o u") 'mairix-update-database)
203 (global-set-key (kbd "C-c C-o f") 'mairix-search-from-this-article)
204 (global-set-key (kbd "C-c C-o t") 'mairix-search-thread-this-article)
205 (global-set-key (kbd "C-c C-o b") 'mairix-widget-search-based-on-article)
206 (global-set-key (kbd "C-c C-o s") 'mairix-save-search)
207 (global-set-key (kbd "C-c C-o i") 'mairix-use-saved-search)
208 (global-set-key (kbd "C-c C-o e") 'mairix-edit-saved-searches)
211 Here's a description of the available interactive functions:
216 @kindex M-x mairix-search
217 @findex mairix-search
218 @vindex mairix-search-file
219 @vindex mairix-file-path
220 @vindex mairix-command
221 @vindex mairix-search-options
222 Call mairix with a search query. You will also be asked if you want to
223 include whole threads. The results are saved by mairix in the default
224 mail file, which is set through the variable @code{mairix-search-file}, which
225 again is prefixed by @code{mairix-file-path}. The results will then be
226 displayed with the chosen mail program. The command used to call mairix
227 is specified by the variable @code{mairix-command}, together with the options
228 @code{mairix-search-options}. The latter has the default @option{-F}
229 for making searching faster.
231 @item mairix-widget-search
232 @kindex M-x mairix-widget-search
233 @findex mairix-widget-search
234 @vindex mairix-widget-fields-list
235 Creates a mairix query using graphical widgets. Very handy if you're
236 not (yet) familiar with the mairix search syntax. Just call it to see
237 how it works. You can then directly call mairix with the search term or
238 save it for future use. Since mairix allows almost arbitrary
239 combinations of search commands (like ``tc'' for ``to or cc''), you
240 might want to include some other fields. This can be easily done by
241 modifying @code{mairix-widget-fields-list}.
243 @item mairix-widget-search-based-on-article
244 @kindex M-x mairix-widget-search-based-on-article
245 @findex mairix-widget-search-based-on-article
246 Create a mairix query using graphical widgets, but based on the
247 currently displayed article, i.e., the available fields will be filled
248 with the current header values.
250 @item mairix-search-from-this-article
251 @kindex M-x mairix-search-from-this-article
252 @findex mairix-search-from-this-article
253 Search messages from sender of the current article. This is effectively
254 a shortcut for calling @code{mairix-search} with @code{f:current_from}.
255 If used with a prefix, include whole threads of the found messages.
257 @item mairix-search-thread-this-article
258 @kindex M-x mairix-search-thread-this-article
259 @findex mairix-search-thread-this-article
260 Search thread for the current article. This is effectively a shortcut
261 for calling @code{mairix-search} with @code{m:msgid} of the current article and
264 @item mairix-save-search
265 @kindex M-x mairix-save-search
266 @findex mairix-save-search
267 Save the last search for future use. You will have to specify a name
268 for the search and will then be asked if you want to save your saved
269 searches in your @file{.emacs}. If you answer with yes, the variable
270 @code{mairix-saved-searches} will be saved in the customize section of
271 your @file{.emacs}. You can also do this later by using
272 @code{mairix-edit-saved-searches}.
274 @item mairix-use-saved-search
275 @kindex M-x mairix-use-saved-search
276 @findex mairix-use-saved-search
277 Call mairix with a previously saved search. You will be asked for the
278 name of the saved search (use @kbd{TAB} for completion).
280 @item mairix-edit-saved-searches
281 @kindex M-x mairix-edit-saved-searches
282 @findex mairix-edit-saved-searches
283 Edit your current mairix searches. This is a simple major mode for
284 editing the contents of the variable @code{mairix-saved-searches}. You
285 can edit and delete searches and save them in your @file{.emacs}. You
286 can also use this mode to call mairix with one of the saved searches.
287 Additionally, you can specify a file name for mairix to use for a
288 certain search instead of the default one. This is useful if you want
289 to open different searches at the same time, or if you want to regularly
290 access certain searches without the need to call mairix.
292 @item mairix-edit-saved-searches-customize
293 @kindex M-x mairix-edit-saved-searches-customize
294 @findex mairix-edit-saved-searches-customize
295 Edit the variable @code{mairix-saved-searches} in a normal customization
296 buffer. This function exists more or less for historic reasons, but
299 @item mairix-update-database
300 @kindex M-x mairix-update-database
301 @findex mairix-update-database
302 @vindex mairix-update-options
303 @vindex mairix-synchronous-update
304 Call mairix to update the database. Mairix will be called with the
305 options @code{mairix-update-options}; the default is @option{-F} and
307 make updates as fast as possible. Note that by using these options,
308 absolutely no integrity checking is done. If your database somehow gets
309 corrupted, simply delete it and update. If @code{mairix-synchronous-update}
310 is @code{nil} (the default), mairix will be called in a subprocess so Emacs
311 will still be usable while the update is done.
317 @chapter Extending mairix.el
319 Your favorite Emacs mail program is not supported? Shame on me. But
320 it is really easy to integrate other mail programs into mairix.el. Just
324 @item Write a display function
325 Write a function that displays the mairix search results. This function
326 will be called from @code{mairix.el} with the mail file/folder as the
327 single argument. For example, the function @code{mairix-rmail-display}
328 is currently used for RMail and @code{mairix-gnus-ephemeral-nndoc} is
331 @item Write a get-header function
332 Write a function that retrieves a header from the currently active mail.
333 The single argument for this function is a string with the header name.
334 For examples, see @code{mairix-rmail-fetch-field} and
335 @code{mairix-gnus-fetch-field} for RMail and Gnus, respectively.
337 @item Integrate the functions into mairix.el
338 Add your mail program to the defcustom of @code{mairix-mail-program}.
339 Then add the functions to @code{mairix-display-functions} and
340 @code{mairix-get-mail-header-functions}.
343 ...so that I can eventually integrate it into future versions of mairix.el.
348 @node GNU Free Documentation License
349 @appendix GNU Free Documentation License
350 @include doclicense.texi