Variable: Buffer-menu-group-by

Buffer-menu-group-by is a customizable variable defined in buff-menu.el.gz.

Value

nil

Documentation

If non-nil, functions to call to divide buffer-menu buffers into groups.

When customized to a function, this function should return names of all levels for each entry. When customized to a list of functions, then each function defines the group name at each nested level of multiple levels. Each function is called with one argument: a list of entries in the same format as in tabulated-list-entries, and should return a list in the format suitable for tabulated-list-groups(var)/tabulated-list-groups(fun). Also, when this variable is non-nil, outline-minor-mode(var)/outline-minor-mode(fun) is enabled in the Buffer Menu and you can use Outline minor mode commands to show/hide groups of buffers, according to the value of outline-regexp. The default options can group by a mode, and by a root directory of a project or just default-directory. If this is nil, buffers are not divided into groups.

This variable was added, or its default value changed, in Emacs 30.1.

Probably introduced at or before Emacs version 30.1.

Source Code

;; Defined in /usr/src/emacs/lisp/buff-menu.el.gz
(defcustom Buffer-menu-group-by nil
  "If non-nil, functions to call to divide buffer-menu buffers into groups.
When customized to a function, this function should return names
of all levels for each entry.
When customized to a list of functions, then each function defines
the group name at each nested level of multiple levels.
Each function is called with one argument: a list of entries in the same
format as in `tabulated-list-entries', and should return a list in the
format suitable for `tabulated-list-groups'.  Also, when this variable
is non-nil, `outline-minor-mode' is enabled in the Buffer Menu and you
can use Outline minor mode commands to show/hide groups of buffers,
according to the value of `outline-regexp'.
The default options can group by a mode, and by a root directory of
a project or just `default-directory'.
If this is nil, buffers are not divided into groups."
  :type '(choice (const :tag "No grouping" nil)
                 (function :tag "Custom function")
                 (repeat :tag "Use levels"
                  (choice
                   (const :tag "Group by project root or directory"
                          Buffer-menu-group-by-root)
                   (const :tag "Group by mode"
                          Buffer-menu-group-by-mode)
                   (function :tag "Custom level function"))))
  :group 'Buffer-menu
  :version "30.1")