wsbdww
Last Updated: February 25, 2016
·
1.041K
· jsinglet

A Quick Easy Buffer Menu for Emacs

The one thing I absolutly love about IntelliJ is the little buffer switching menu you get with Super+G. Desperate to get this feature in Emacs, I whipped this little bit of Lisp up to help fill the gap.

;; used for quick menu switching between buffers
(defun menu-list-from-buffers () 
  (cons "PANE" (mapcar (lambda (e)  (list (buffer-name e) e)) (remove-if (lambda (e)  (string-match "\*.*\*" (buffer-name e))  )(buffer-list))))
)

(defun menu-switch ()
  (interactive)
  (set-window-buffer nil (car (x-popup-menu t (list "Switch To Buffer" (menu-list-from-buffers)))))
)

(global-set-key (kbd "s-g") 'menu-switch)

Note that I've bound this function to Super+G. For Mac users this is Apple+G. Drop that little badboy into your .emacs file and you're off!

When you get it going it will look pretty much like this:

Picture

Say Thanks
Respond