The buffer menu presents a list of buffers. It is similar to how DiredMode operates with files. Command
‘M-x buffer-menu’ lists the buffers in the current window. This is an alternative to the default listing of buffers with ListBuffers.
According to the EmacsManual:
‘C-x C-b’(List Buffers) does not merely list buffers. It also allows you to perform various operations on buffers, through an interface similar to Dired. You can save buffers, kill them (here called “deleting” them, for consistency with Dired), or display them.
‘C-x C-b’and switch to the window displaying the `
*Buffer List*’ buffer. You can also type
‘M-x buffer-menu’to open the buffer menu in the selected window. Alternatively, the command
‘M-x buffer-menu-other-window’opens the buffer menu in another window, and selects that window.
‘C-h m’, as always) in the `
*Buffer List*’ window for more information about possible operations on the buffers listed.
‘C-x C-b’ to command
(global-set-key (kbd "C-x C-b") 'buffer-menu)
The relation between
‘buffer-menu’ is a bit like that between
‘C-x C-d’) and
‘C-x d’): one is for listing, the other is for listing and manipulating. However, you can just select the window displayed by
‘list-buffers’, to act on its listed buffers.
Enhancements to vanilla buffer menu:
(defun Buffer-menu-other-frame () (interactive) (switch-to-buffer-other-frame (Buffer-menu-buffer t))) (define-key Buffer-menu-mode-map "5" 'Buffer-menu-other-frame)
(defun Buffer-menu-rename-buffer (newname) "Rename buffer at line in window." (interactive (list (read-buffer "Rename buffer (to new name): " (buffer-name (Buffer-menu-buffer t))))) (with-current-buffer (Buffer-menu-buffer t) (rename-buffer newname)) (revert-buffer)) (define-key Buffer-menu-mode-map "R" 'Buffer-menu-rename-buffer)