Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/emacs-helm/helm-mu

Helm sources for searching emails and contacts using mu
https://github.com/emacs-helm/helm-mu

Last synced: 3 months ago
JSON representation

Helm sources for searching emails and contacts using mu

Awesome Lists containing this project

README

        

#+TITLE: Helm-mu – Helm search for e-mails and contact in mu4e
#+Options: num:nil

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

Helm-mu is a helm frontend for [[https://github.com/djcb/mu][Mu]], an indexer for maildirs, and for mu4e, a mutt-like MUA for Emacs built 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’s, e.g:

#+BEGIN_EXAMPLE
from:Adam to:Eve flag:attach vacation photos
#+END_EXAMPLE

* News

- [2022-12-17 Sat] :: To override mu4e's default search function, you now have to use: ~(define-key mu4e-search-minor-mode-map "s" 'helm-mu)~
- [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. Helm also needs to be properly installed and configured. This involves putting the following line in your startup file (see [[https://github.com/emacs-helm/helm#install-from-emacs-packaging-system][Helm’s documentation]] for details):

#+BEGIN_SRC emacs-lisp
(require 'helm)
#+END_SRC

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:

#+BEGIN_SRC emacs-lisp
(require 'helm-mu)
#+END_SRC

Alternatively, you can use the autoload facility:

#+BEGIN_SRC emacs-lisp
(autoload 'helm-mu "helm-mu" "" t)
(autoload 'helm-mu-contacts "helm-mu" "" t)
#+END_SRC

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:

#+BEGIN_SRC sh
brew install gnu-sed --with-default-names
#+END_SRC

*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-always-use-default-search-string~
- ~helm-mu-skip-duplicates~
- ~helm-mu-contacts-name-colwidth~
- ~helm-mu-contacts-name-replace~
- ~helm-mu-contacts-after~
- ~helm-mu-contacts-personal~
- ~helm-mu-gnu-sed-program~
- ~helm-mu-append-implicit-wildcard~
- ~helm-mu-command-arguments~

* Configuration

** Default search string

The default search string is the empty string. This means that if you fire up helm-mu, you will initially 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):

#+BEGIN_SRC elisp
(setq helm-mu-default-search-string "(maildir:/INBOX OR maildir:/Sent)")
#+END_SRC

** 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.:

#+BEGIN_SRC elisp
(setq helm-mu-contacts-after "01-Jan-1995 00:00:00")
#+END_SRC

** 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~:

#+BEGIN_SRC elisp
(setq helm-mu-contacts-personal t)
#+END_SRC

** 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:

#+BEGIN_SRC elisp
(define-key mu4e-search-minor-mode-map "s" 'helm-mu)
#+END_SRC

* 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 e-mail 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 show the current search results in a regular mu4e header-view press ~S-~. When you call helm-mu in a header-view or from an e-mail, the default search will show the same content as the current header-view.

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).