Saturday, February 08, 2014

Searching GMail Using IMap And GNUS

Searching GMail Using IMap and GNUS

1 Searching GMail Using IMap and GNUS

Emacs package GNUS provides a very efficient interface for consuming large amounts of email. You can access GMail using GNUS' IMap interface, for my own configuration for doing this, see file tvr/gnus-prepare.el in the Emacspeak SVN repository. Module gm-nnir.el in package g-client implements some convenience hooks to enable efficient searching of GMail. Module emacspeak-gnus has been updated to bind commands from module gm-nnir.el to ? and / in the Group buffer.

1.1 Basic Usage

Assuming you already have GNUS configured to read GMail via IMap, you can:

  • Press / in the groups buffer to search your mail. This command accepts all GMail queries, so for example,
after: 2014/02/01 to: me

Will find all messages received after February 1, 2014 and addressed to you.

label: foo after: 2014/01/01

Will find messages with label foo and received after January 1, 2014.

  • Press ? in the Group buffer to execute a more extensive search command; this accepts both IMap query specifications (per RFC 3501) as well as GMail query specifications. The command provides smart completion, follow the prompts to build up complex queries. In general, there is almost nothing you cannot do with the GMail query language, so this command is mostly there as a backup.

1.2 The Technical Details

The GMail query language is exposed to IMap via custom search key X-GM-RAW; commands gm-nnir-group-make-gmail-group and gm-nnir-group-make-nnir-group use this functionality to construct ephemeral groups that hold the search results.