Helm sources for searching emails and contacts using mu
Emacs Lisp
Latest commit 1f9a6b0 Oct 10, 2016 @tmalsburg tmalsburg committed on GitHub Merge pull request #40 from muahah/Option_to_add_parameters_to_mu
Add option to pass arguments to the mu command
Permalink
Failed to load latest commit information.
LICENSE Initial commit Oct 15, 2013
README.org Added news section. May 31, 2016
helm-mu.el Add option to pass arguments to the mu command Oct 9, 2016

README.org

Helm-mu – A Helm front-end for the maildir indexer mu and the mail user agent mu4e

http://melpa.org/packages/helm-mu-badge.svg

Mu is an indexer for maildirs and mu4e is a mutt-like MUA for Emacs build on top of mu. Mu is highly efficient, which makes it possible to get instant search results even for huge maildirs. It also provides search operators similar to Google mail, e.g:

from:Titus to:Anne flag:attach vacation photos

News

[2016-05-31 Tue]
Added two new actions in helm-mu-contacts: 1. Insert selected contacts at point. 2) Copy selected contacts to clipboard. Contacts are inserted/copied in a format that is suitable for address fields, i.e. with quote names and email addresses.

Install

Helm-mu requires a fully configured mu4e setup. Also make sure that Helm is properly installed and configured. This involves putting the following line in your startup file (see Helm’s documentation for details):

(require 'helm-config)

The preferred way to install helm-mu is through MELPA but you can also place the file helm-mu.el in a directory included in your load-path. In the latter case, add the following to your init file:

(require 'helm-mu)

Alternatively, you can use the autoload facility:

(autoload 'helm-mu "helm-mu" "" t)
(autoload 'helm-mu-contacts "helm-mu" "" t)

To run mu, helm-mu uses the function start-process-shell-command. It assumes that the shell called by that function is compatible with the Bourne shell (e.g., bash).

GNU sed is used to do some filtering of the results returned by mu. GNU sed is standard on Linux, but OSX users will need to install GNU sed – OSXs default BSD sed will throw errors.

To install GNU sed on OSX using Homebrew:

brew install gnu-sed --with-default-names

Note: With standard Homebrew configurations, installing GNU sed in this way will block the default BSD sed.

Customization variables are listed below. See the documentation within Emacs for details.

  • helm-mu-default-search-string
  • helm-mu-contacts-name-colwidth
  • helm-mu-contacts-name-replace
  • helm-mu-contacts-after
  • helm-mu-contacts-personal

Configuration

Default search string

The default search string is the empty string. This means that if you fire up helm-mu, initially you see all emails from all mailboxes. To configure a different default search, use the variable helm-mu-default-search-string. For example, to see only emails from your inbox and sent folder the following may work (depending on the names of these mailboxes on your system):

(setq helm-mu-default-search-string "(maildir:/INBOX OR maildir:/Sent)")

Only show contacts first recorded after a certain date

If you mail repository is old it may include many contacts that are not anymore relevant. You can constrain the search to contacts first encountered after a certain date using the variable helm-mu-contacts-after, e.g.:

(setq helm-mu-contacts-after "01-Jan-1995 00:00:00")

Only show contacts who sent you emails directly

Some people only send you emails through mailing lists. You can exclude these contacts using the variable helm-mu-contacts-personal:

(setq helm-mu-contacts-personal t)

Use helm-mu instead of Mu4e’s search

When you press s in Mu4e, this starts a new search. If you want to replace Mu4e’s search function by helm-mu, add the following to your configuration file:

(define-key mu4e-main-mode-map "s" 'helm-mu)
(define-key mu4e-headers-mode-map "s" 'helm-mu)
(define-key mu4e-view-mode-map "s" 'helm-mu)

Usage

To search for emails use the command helm-mu (e.g., M-x helm-mu). When you would like to read an email without finishing the helm session, you can select the email and press C-z. This will split the screen horizontally and show the email in the new window while keeping the search results in the other. Alternatively, you can open the email using the enter key and return to the helm session using the command helm-resume. By default a * is appended to the search query entered by the user before passing it to mu, this allows getting results for partially entered queries. This behavior can be disabled by customizing the variable helm-mu-append-implicit-wildcard.

To search for contacts use helm-mu-contacts (e.g., M-x helm-mu-contacts). Note that search terms are interpreted differently by helm-mu-contacts than by helm-mu. The latter assumes that the search terms are complete words, i.e., that they are surrounded by white spaces or punctuation. So if you search for jo it will only return emails in which jo occurs as a word. In contrast to that, helm-mu-contacts will return all contacts in which jo occurs as a substring.

helm-mu-contacts uses the grep tool for searching. That means that any regular expression supported by grep can be used when searching for contacts.

helm-mu-contacts offers four actions that can be performed on selected contacts:

  1. Compose email addressed to selected contacts.
  2. Get the emails from/to the selected contacts.
  3. Insert contacts at point.
  4. Copy contacts to clipboard.

Select one or multiple contacts and press TAB to see the list of available actions. Use M-SPC to select multiple contacts (works in all helm sources).