This file provides a Gnus nnir interface for MacOS Spotlight. As of it, you need MacOS X and Spotlight enabled. You can use it with `nnmh’, `nnml’, and `nnmaildir’ (offlineimap, procmail) methods.
You may need to install the MailSpool importer, which can create appropriate metadata from individual mail spool file. It can be downloaded from http://www.yoshidam.net/diary/Spotlight/.
% cp -pr MailSpool.mdimporter ~/Library/Spotlight/ % mdimport -L # see if the importer is recognized % mdimport -d2 -n ~/Mail/test # see if the importer appropriately works. % mdimport ~/Mail # import! % mdls ~/Mail/test/1 # see if appropriate metadata are created.
You should choose the methods to be used with Spotlight.
(require 'nnir-spotlight) (setq nnir-method-default-engines '((nnmaildir . spotlight) (nnml . spotlight) (nntp . gmane)))
If you are using `nnml’, specifying mail directory may be sufficient. Make sure that the prefix ends with “/”.
;; nnml/nnmh (setq gnus-select-method '(nnml "")) (setq nnir-spotlight-prefix "/home/john/Mail/")
or
(setq gnus-select-method '(nnml "" (nnir-spotlight-prefix "/home/john/Mail/")))
or
;; nnmaildir (setq gnus-select-method '(nnmaildir "" (directory "~/Maildir")))
If `directory’ attribute is specified, it will be used for prefix. Otherwise, `nnir-spotlight-prefix’ will be used.
In `gnus-group-make-nnir-group’ query, you can use the `mdfind’ query syntax. They can be parenthesized to make a complex searching.
- kMDItemTitle ==
- Mail Subject
- kMDItemAuthorEmailAddresses ==
- Email author addresses
- kMDItemAuthors ==
- Email author
- kMDItemRecipientEmailAddresses ==
- Email recipients addresses
- kMDItemRecipients ==
- Email recipients
- kMDItemContentCreationDate
- email date
For example, the the following query searches for the mail which contains foobar in title and sent within three days, containing either foo or bar in content.
kMDItemTitle == "*foobar*" && kMDItemContentCreationDate >= $time.today(-3) && (foo || bar)