Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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!)

like image 568
Kaffiene Avatar asked May 22 '12 21:05

Kaffiene


People also ask

How do I list all buffers in Emacs?

The “Buffers” pull-down menu has an item, List All Buffers, which opens the buffer menu. Screenshot of the buffer menu as it appears in Emacs 27.1 (released 2020 August):

How does iflipb-next-buffer work in XEmacs?

iflipb-next-buffer behaves like Alt-TAB: it switches to the previously used buffer, just like C-x b RET (or C-M-l in XEmacs). However, another consecutive call to iflipb-next-buffer switches to the next buffer in the buffer list, and so on. When such a consecutive call is made, the skipped-over buffer is not regarded as visited.

How do I open multiple frames in Emacs?

They’re just windows in the normal sense of the word—you can drag them around the screen or close them with the `X` button or do whatever you do with windows. In the command line version of Emacs, you only ever have one frame. However, with the GUI (graphical) version you can open multiple frames, which looks like this: OK, you’re still confused!

What is a mode in Emacs?

Modes are Emacs’ way of switching between key bindings, functionality, syntax highlighting and pretty much any other mutable item in Emacs. Modes are always buffer-specific, and they come in two flavors: major modes and minor modes. In Emacs a buffer can only have one major mode, but any number of minor modes.


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 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

like image 82
phils Avatar answered Nov 02 '22 01:11

phils


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)
like image 37
Paul Avatar answered Nov 02 '22 00:11

Paul