When I used vanilla Emacs,
showed me the list of files I had open, with special buffers filtered out.
Recently I switched to Emacs Prelude, which uses
ibuffer, and I'm not sure why the letter T trick won't work.
Emacs Prelude binds C-xC-b to
ibuffer. What T does in the
*Buffer List* buffer, /v does in the
*Ibuffer* buffer. This filter was only added in Emacs 26, however, so before that you have to emulate it: /fRET will filter by buffers associated with a file, but this does not exclude all special buffers, such as Magit buffers. You can then, for example, filter the list further by excluding starred buffers: /n
Type ? in
*Ibuffer* for a listing of
ibuffer commands and their key bindings.
In order to backport /v to Emacs versions prior to 26, rather than emulating it with more complex filter combinations, you can write something like
(with-eval-after-load 'ibuffer (define-ibuffer-filter my-visiting-file "Limit current view to buffers that are visiting a file." (:description "visiting a file" :reader nil) (buffer-file-name buf)) (define-key ibuffer-mode-map (kbd "/ v") #'ibuffer-filter-by-my-visiting-file))
When I used vanilla Emacs, C-xC-bT showed me the list of files I had open, with special buffers filtered out.
Indeed, this is because C-hkC-xC-b (or M-x
describe-keyRETC-xC-b) reveals the key is bound to the
list-buffers command by default:
C-x C-b runs the command list-buffers (found in global-map), which is an interactive compiled Lisp function in ‘buff-menu.el’. It is bound to C-x C-b, <menu-bar> <buffer> <list-all-buffers>. (list-buffers &optional ARG) Display a list of existing buffers. The list is displayed in a buffer named "*Buffer List*". See ‘buffer-menu’ for a description of the Buffer Menu. By default, all buffers are listed except those whose names start with a space (which are for internal use). With prefix argument ARG, show only buffers that are visiting files.
*Buffer List* buffer has
Buffer-menu-mode enabled, under which C-hkT reveals:
T runs the command Buffer-menu-toggle-files-only (found in Buffer-menu-mode-map), which is an interactive compiled Lisp function in ‘buff-menu.el’. It is bound to T, <menu-bar> <Buffer-menu-mode> <tf>. (Buffer-menu-toggle-files-only ARG) Toggle whether the current buffer-menu displays only file buffers. With a positive ARG, display only file buffers. With zero or negative ARG, display other buffers as well.
You can read more about this buffer list and menu in the Emacs Manual under
(emacs) List Buffers and
(emacs) Several Buffers and in the docstrings of C-hf
buffer-menuRET (or M-x
buffer-menuRET) and C-hf
Recently I switched to Emacs Prelude, which uses
I'm not sure why the letter T trick won't work.
ibuffer provides a superset of
buffer-menu functionality, the two are mostly, if not completely, disjoint modes, with many different keybindings. In the
*Ibuffer* buffer, C-hkT reveals:
T runs the command ibuffer-do-toggle-read-only (found in ibuffer-mode-map), which is an interactive compiled Lisp function in ‘ibuffer.el’. It is bound to T. (ibuffer-do-toggle-read-only &optional ARG) Toggle read only status in marked buffers. If optional ARG is a non-negative integer, make buffers read only. If ARG is a negative integer or 0, make buffers writable. Otherwise, toggle read only status.
In order to find the functionality you are looking for, as well as other
ibuffer features, I recommend typing ? (or C-hm or M-x
describe-modeRET) in the
*Ibuffer* buffer and reading through the mode's description.
Here you may spot that /v is bound to
/ v runs the command ibuffer-filter-by-visiting-file (found in ibuffer-mode-map), which is an interactive autoloaded compiled Lisp function in ‘ibuf-ext.el’. It is bound to / v, <menu-bar> <view> <filter> <filter-by-visiting-file>. (ibuffer-filter-by-visiting-file QUALIFIER) Limit current view to buffers that are visiting a file.
which is analogous to T under
*Buffer List*, and /* is bound to
/ * runs the command ibuffer-filter-by-starred-name (found in ibuffer-mode-map), which is an interactive autoloaded compiled Lisp function in ‘ibuf-ext.el’. It is bound to / *, <menu-bar> <view> <filter> <filter-by-starred-name>. (ibuffer-filter-by-starred-name QUALIFIER) Limit current view to buffers with name beginning and ending with *, along with an optional suffix of the form digits or <digits>.
which is not too divorced from the inverse operation (you can precisely invert a filter via /!).
In general, I recommend giving default bindings a chance to grow on you, but if your muscle memory is too strong and/or you don't like
ibuffer's default bindings too much, you can emulate the behaviour under
*Buffer List* by rebinding T to
(with-eval-after-load 'ibuffer (define-key ibuffer-mode-map "T" #'ibuffer-filter-by-visiting-file))
or equivalently, if you prefer named and documented hooks to anonymous
(defun my-ibuffer-setup-bindings () "Customise `ibuffer' key bindings." (define-key ibuffer-mode-map "T" #'ibuffer-filter-by-visiting-file)) (add-hook 'ibuffer-load-hook #'my-ibuffer-setup-bindings)