tags:

views:

40

answers:

1

Hey folks,

is it possible to invoke the graphical menu that pops up with 'mouse-buffer-menu (which in my case is assigned to '[C-down-mouse-1]) without actually hitting the mouse? When I invoke M-x mouse-buffer-menu emacs tells me

execute-extended-command: mouse-buffer-menu must be bound to an event with parameters

Is it possible, to generate such an event?

What I would like to have is a list (i.e. a graphical popup menu), where I can choose between the set of open buffers by selecting them using the UP/DOWN keys. I am well aware of buffer-menu, but unfortunately, that only provides a read-only list of all buffers, without the option of choosing one.

Kind regards, mefiX

+4  A: 

After doing a bit of digging and playing I created an event and passed it to mouse-buffer-menu.

You can play with the numbers in the list for the desired effect.

(setq my-dummy-event `(mouse-1 (,(selected-window) 0 (0 . 0) 0 nil 0 (0 . 0) nil nil nil) 1))

(mouse-buffer-menu my-dummy-event)

Look at the emacs manual node for Click Events to find out the structure of the event list.

As a side note have you considered alternatives for buffer selection such as ido or using something like bs-show to chose your buffer:

(global-set-key "\C-x\C-b" 'bs-show)

using a to toggle all buffers.

You can also find better alternatives here:

kjfletch
Great! Thank you very much! I am additionally using tabbar.el to switch between buffers. But during work I figured out that I use C-mouse-1 for mouse-buffer-menu very often, but switching to the mouse was going on my nerves :)
mefiX