开发者

Mouse Buffer Menu with keyboard

开发者 https://www.devze.com 2023-01-22 01:03 出处:网络
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-buffe

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 buff开发者_运维技巧ers 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


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:

  • http://www.emacswiki.org/emacs/SwitchingBuffers
  • http://www.emacswiki.org/emacs/CategoryBufferSwitching


A bit late: what about list-buffers (C-x C-b) ? It give a buffer list from which you can select the buffer to show...

0

精彩评论

暂无评论...
验证码 换一张
取 消