Skip to content
Thierry Volpiatto edited this page Sep 2, 2024 · 2 revisions

Table of Contents

Introduction

helm-mode when enabled make all existing completions in Emacs using Helm UI. The behavior of the commands is not modified, only the way completion is provided and look changes.

Enable helm-mode

Add to init file:

(helm-mode 1)

Or use M-x helm-mode to enable or disable it temporarily.

Configure completing-read

helm-completing-read-handlers-alist

This is a powerful variable that allow configuring the behavior of the completing-read running in a specific command, in most cases the command is the top command you want to be affected, but in some cases you will have to find the first interactive command running the completing-read (when the completing-read run, helm walk frames to find the first interactive command that have called the completing-read).

Use completions-detailed variable

When setting this variable to non-nil, helm-mode enables affixation functions in many places and provides completions with additional informations, try for example describe-function with and without.

Misc

You will find several variables doing various things in the helm-mode group, modify as needed.

Configure completion-in-region and completing-read behavior

helm-completion-style

Setting this affect how Helm match candidates, either multi matching, fuzzy/flex matching, or let emacs completion-styles decide how to match candidates, see below.

Helm

This is the default setting, it is safe and fast and use multi-matching to match candidates.

Helm-fuzzy

Provide fuzzy matching to match candidates. It uses now by default the emacs flex algorithm. When using this you can switch at any moment to multi-match as soon as you enter a space in your query.

Emacs

This honor completion-styles to match candidates. However it is much slower than the helm* methods. Note that the helm style which provide multi-matching is always added on top of completion-styles.

helm-completion-styles-alist

In some cases, it is better to use one helm-completion-style for something other than the default, this variable allows this. For example, say you use globally helm as helm-completion-style but you want to use emacs with wfnames-mode, you add (wfnames-mode emacs helm flex) to helm-completion-styles-alist, this will enable emacs style when switching to a wfnames buffer with helm and flex as completion-styles (this is part of the current default value). Note that you can configure here the behavior of commands as well as with modes, both completion-in-region and completing-read, read-file-name etc… will be affected.

Use completing-read-multiple with Helm-mode enabled

When using completing-read-multiple when helm-mode is enabled you don’t have to use it like in emacs vanilla, that is pressing TAB after each completion done, just mark all you need and keep going.

Allow marked candidates in completing-read

Even better is to get rid of completing-read-multiple when writing your elisp applications, for this let bind the variable helm-comp-read-use-marked around a completing-read call, this will allow the completing-read to return a list of marked candidates instead of a single candidate, of course don’t forget to provide a completing-read-multiple as fallback for non helm users.

e.g.

(let ((helm-comp-read-use-marked t))
  (if (and (boundp 'helm-mode) helm-mode)
      (completing-read ...)
    (completing-read-multiple ...)))