Function: tabulated-list-mode
tabulated-list-mode is an interactive and byte-compiled function
defined in tabulated-list.el.gz.
Signature
(tabulated-list-mode)
Documentation
Generic major mode for browsing a list of items.
This mode is usually not used directly; instead, other major
modes are derived from it, using define-derived-mode.
In this major mode, the buffer is divided into multiple columns, which are labeled using the header line. Each non-empty line belongs to one "entry", and the entries can be sorted according to their column values.
An inheriting mode should usually do the following in their body:
- Set tabulated-list-format, specifying the column format.
- Set tabulated-list-revert-hook, if the buffer contents need
to be specially recomputed prior to revert-buffer.
- Maybe set a tabulated-list-entries function (see below).
- Maybe set tabulated-list-printer (see below).
- Maybe set tabulated-list-padding.
- Call tabulated-list-init-header to initialize header-line-format
according to tabulated-list-format.
An inheriting mode is usually accompanied by a "list-FOO"
command (e.g. list-packages, list-processes). This command
creates or switches to a buffer and enables the major mode in
that buffer. If tabulated-list-entries is not a function, the
command should initialize it to a list of entries for displaying.
Finally, it should call tabulated-list-print.
tabulated-list-print calls the printer function specified by
tabulated-list-printer, once for each entry. The default
printer is tabulated-list-print-entry, but a mode that keeps
data in an ewoc may instead specify a printer function (e.g., one
that calls ewoc-enter-last), with tabulated-list-print-entry
as the ewoc pretty-printer.
In addition to any hooks its parent mode special-mode might have run,
this mode runs the hook tabulated-list-mode-hook, as the final or
penultimate step during initialization.
- negative-argument
0 digit-argument
1 digit-argument
2 digit-argument
3 digit-argument
4 digit-argument
5 digit-argument
6 digit-argument
7 digit-argument
8 digit-argument
9 digit-argument
< beginning-of-buffer
<follow-link> mouse-face
<keymap> C-M-i backward-button
<keymap> TAB forward-button
<mouse-2> mouse-select-window
> end-of-buffer
? describe-mode
DEL scroll-down-command
M-<left> tabulated-list-previous-column
M-<right> tabulated-list-next-column
S tabulated-list-sort
S-SPC scroll-down-command
SPC scroll-up-command
SPC..~ undefined
g revert-buffer
h describe-mode
n next-line
p previous-line
q quit-window
{ tabulated-list-narrow-current-column
} tabulated-list-widen-current-column
Probably introduced at or before Emacs version 25.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/tabulated-list.el.gz
(define-derived-mode tabulated-list-mode special-mode "Tabulated"
"Generic major mode for browsing a list of items.
This mode is usually not used directly; instead, other major
modes are derived from it, using `define-derived-mode'.
In this major mode, the buffer is divided into multiple columns,
which are labeled using the header line. Each non-empty line
belongs to one \"entry\", and the entries can be sorted according
to their column values.
An inheriting mode should usually do the following in their body:
- Set `tabulated-list-format', specifying the column format.
- Set `tabulated-list-revert-hook', if the buffer contents need
to be specially recomputed prior to `revert-buffer'.
- Maybe set a `tabulated-list-entries' function (see below).
- Maybe set `tabulated-list-printer' (see below).
- Maybe set `tabulated-list-padding'.
- Call `tabulated-list-init-header' to initialize `header-line-format'
according to `tabulated-list-format'.
An inheriting mode is usually accompanied by a \"list-FOO\"
command (e.g. `list-packages', `list-processes'). This command
creates or switches to a buffer and enables the major mode in
that buffer. If `tabulated-list-entries' is not a function, the
command should initialize it to a list of entries for displaying.
Finally, it should call `tabulated-list-print'.
`tabulated-list-print' calls the printer function specified by
`tabulated-list-printer', once for each entry. The default
printer is `tabulated-list-print-entry', but a mode that keeps
data in an ewoc may instead specify a printer function (e.g., one
that calls `ewoc-enter-last'), with `tabulated-list-print-entry'
as the ewoc pretty-printer."
(setq-local truncate-lines t)
(setq-local buffer-undo-list t)
(setq-local revert-buffer-function #'tabulated-list-revert)
(setq-local glyphless-char-display
(tabulated-list-make-glyphless-char-display-table))
(setq-local text-scale-remap-header-line t)
(setq-local tabulated-list--original-order nil)
;; Avoid messing up the entries' display just because the first
;; column of the first entry happens to begin with a R2L letter.
(setq bidi-paragraph-direction 'left-to-right)
(header-line-indent-mode))