When I try to filter buffers by mode in ibuffer, I am not able to filter by major mode helm-mode. For example,

 MR Name                 Size Mode
 -- ----                 ---- ----
 *  *helm apropos*        117 Helm             
 *  *helm projectile*    3633 Helm             
 *  *helm-package*        187 Helm             

these three buffers say "Helm" in the mode column, but will only match fundamental-mode when filtering on major mode or derived mode. Is this a bug?

1 Answer 1


It is not a bug. helm.el does not provide any major mode for helm buffers. So they are infact in fundamental-mode. However it does set the variable mode-name to Helm which is what you are seeing in the mode column. The mode-name variable is a buffer local variable that can contain a user friendly name for the buffer's major-mode and is/can be different from major-mode.

Check out the defun helm-create-helm-buffer for more details.

Note that ibuffer lets you mark all helm buffers by marking by mode regexp % m followed by Helm at the prompt. The usual * M does not work though. If you want to create filter groups for helm, you can use the ibuffer-filter-by-predicate mapped to / e and entering the following at the prompt.

(string-match "Helm" mode-name)

For instance, here is a working example of a saved filter group

enter image description here

and here is the resulting ibuffer window after ibuffer-switch-to-saved-filter-groups.

enter image description here

I can only guess why Helm does not have a dedicated major mode. Unlike buffers with major modes

  • helm completion buffers are always disposable,
  • do not need any special syntax map,
  • font-lock is dependent upon the command invoked
  • most importantly, keymap is active only for the active helm buffer

So there is no special reason for these buffers to have a dedicated major-mode. You can ask the maintainer for his reasons though. Maybe, the overhead of having a major-mode is not worth the trivial advantages it brings.

  • Unfortunately buffer marking functions do not allow me to create custom filter groups.
    – nispio
    Oct 15, 2014 at 13:12
  • 1
    Okay, I see what you are saying. So why is Helm changing mode-name without changing the mode? Why not create an inherited mode from fundamental mode and invoke it from helm-create-helm-buffer? Would there be some disadvantage to creating a helm mode vs faking it by overwriting mode-name?
    – nispio
    Oct 15, 2014 at 13:15
  • Regarding why there is no dedicated major mode, I can only guess the intentions of the maintainer. There is nothing to be gained by defining a new major mode for helm completion buffers which are disposable. Mode-name is just the lighter for the modeline. For instance the scratch buffer has a major mode of lisp-interaction-mode while its mode-name is Lisp Interaction. mode-name is visible to the user, so a friendly string is often used.
    – Vamsi
    Oct 15, 2014 at 15:43
  • @nispio I have edited the answer to show how you can filter helm buffers as well.
    – Vamsi
    Oct 15, 2014 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.