How to 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 favorite way of switching buffers, but the list of buffers should not be too long before it re-organizes the list in a submenu (main, LISP, others, etc.). I really hate this because it is much harder for me 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 splits the menu into submenus? (I want to increase it, obviously!)

+7
source share
2 answers

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 main mode before this mode gets its own submenu, and the first is the maximum number of buffers allowed in any sub / menu before it is divided into several menus .

setq , if necessary, or
Mx customize-group RET mouse RET

+4
source

full code with details for adding to the .emacs file is below

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

to evaluate below and see the effect immediately, select and type Mx eval-region or place the cursor inside each () and type MCx

 ;; "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) 
+2
source

All Articles