Kaffiene
Kaffiene

Reputation: 713

How do I set the number of items in the mouse buffer menu in Emacs?

When I press ctrl+left-mouse-button in Emacs, I get the mouse buffer menu. This is my favourite way of switching buffers, but the list of buffers doesn't have to be too long before it re-organises the list into sub menus (fundamental, LISP, others etc...). I really hate this because I find it much harder to find the buffer I'm looking for.

My question is: How can I set the number of items in the mouse buffer menu that emacs will show before it breaks the menu into submenus? (I want to increase it, obviously!)

Upvotes: 10

Views: 1553

Answers (2)

Paul
Paul

Reputation: 4168

full code with details to add to .emacs file is below

also note that mouse-buffer-menu-mode-mult takes precedence

to evaluate the below and see effect immediately, highlight and type M-x eval-region or put cursor inside each () and type M-C-x

;; "ctrl - left click" buffer menu: increase number of items shown
;; set max length of this list. default 20. see next.
(setq mouse-buffer-menu-maxlen 30)
;; set # buffer in a mode before grouping begins. takes precedence over previous
;; set to 1 to always group by mode. default 4
(setq mouse-buffer-menu-mode-mult 8)

Upvotes: 5

phils
phils

Reputation: 73314

The following two variables give you some control over this:

  • mouse-buffer-menu-maxlen
  • mouse-buffer-menu-mode-mult

My interpretation is that the latter is the maximum number of buffers in a given major mode before that mode gets its own sub-menu, and the former is the maximum number of buffers allowed in any sub/menu before it is split into multiple menus.

setq as appropriate, or
M-x customize-group RET mouse RET

Upvotes: 9

Related Questions