2022-02-19 12:16:19 +00:00
|
|
|
\input texinfo @c -*-texinfo-*-
|
|
|
|
@c %**start of header
|
|
|
|
@setfilename ../../info/vtable.info
|
|
|
|
@settitle Variable Pitch Tables
|
|
|
|
@include docstyle.texi
|
2022-02-19 13:34:01 +00:00
|
|
|
@c Merge all indexes into a single Index node.
|
|
|
|
@syncodeindex fn cp
|
|
|
|
@syncodeindex vr cp
|
|
|
|
@syncodeindex ky cp
|
2022-02-19 12:16:19 +00:00
|
|
|
@c %**end of header
|
|
|
|
|
|
|
|
@copying
|
|
|
|
This file documents the GNU vtable.el package.
|
|
|
|
|
|
|
|
Copyright @copyright{} 2022 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
@quotation
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
|
|
any later version published by the Free Software Foundation; with no
|
|
|
|
Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
|
|
|
|
and with the Back-Cover Texts as in (a) below. A copy of the license
|
|
|
|
is included in the section entitled ``GNU Free Documentation License.''
|
|
|
|
|
|
|
|
(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
|
|
|
|
modify this GNU manual.''
|
|
|
|
@end quotation
|
|
|
|
@end copying
|
|
|
|
|
|
|
|
@dircategory Emacs misc features
|
|
|
|
@direntry
|
|
|
|
* vtable: (vtable). Variable Pitch Tables.
|
|
|
|
@end direntry
|
|
|
|
|
|
|
|
@finalout
|
|
|
|
|
|
|
|
@titlepage
|
|
|
|
@title Variable Pitch Tables
|
|
|
|
@subtitle Columnar Display of Data.
|
|
|
|
|
|
|
|
@page
|
|
|
|
@vskip 0pt plus 1filll
|
|
|
|
@insertcopying
|
|
|
|
@end titlepage
|
|
|
|
|
|
|
|
@contents
|
|
|
|
|
|
|
|
@ifnottex
|
|
|
|
@node Top
|
|
|
|
@top vtable
|
|
|
|
|
|
|
|
@insertcopying
|
|
|
|
@end ifnottex
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Introduction:: Introduction and examples.
|
|
|
|
* Concepts:: vtable concepts.
|
|
|
|
* Making A Table:: The main interface function.
|
|
|
|
* Commands:: vtable commands.
|
|
|
|
* Interface Functions:: Interface functions.
|
|
|
|
|
|
|
|
Appendices
|
|
|
|
* GNU Free Documentation License:: The license for this documentation.
|
|
|
|
|
|
|
|
Indices
|
|
|
|
* Index::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node Introduction
|
2022-02-19 13:34:01 +00:00
|
|
|
@chapter Introduction and Tutorial
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
Most modes that display tabular data in Emacs use
|
|
|
|
@code{tabulated-list-mode}, but it has some limitations: It assumes
|
|
|
|
that the text it's displaying is monospaced, which makes it difficult
|
2022-02-19 13:34:01 +00:00
|
|
|
to mix fonts and images in a single list. The @dfn{vtable} (``variable
|
|
|
|
pitch tables'') package tackles this instead.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@code{tabulated-list-mode} is a major mode, and assumes that it
|
2022-02-19 13:34:01 +00:00
|
|
|
controls the entire buffer. A vtable doesn't assume that---you can have
|
2022-02-19 12:16:19 +00:00
|
|
|
a vtable in the middle of other data, or have several vtables in the
|
|
|
|
same buffer.
|
|
|
|
|
|
|
|
Here's just about the simplest vtable that can be created:
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
(make-vtable
|
|
|
|
:objects '(("Foo" 1034)
|
|
|
|
("Gazonk" 45)))
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
By default, vtable uses the @code{variable-pitch} font, and
|
|
|
|
right-aligns columns that only have numerical data (and left-aligns
|
|
|
|
the rest).
|
|
|
|
|
|
|
|
You'd normally want to name the columns:
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
(make-vtable
|
|
|
|
:columns '("Name" "ID")
|
|
|
|
:objects '(("Foo" 1034)
|
|
|
|
("Gazonk" 45)))
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
Clicking on the column names will sort the table based on the data in
|
|
|
|
each object (and in this example, each object is just a simple list).
|
|
|
|
|
|
|
|
By default, the data is displayed ``as is'', that is, the way
|
|
|
|
@samp{(format "%s" ...)} would display it, but you can override that.
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
(make-vtable
|
|
|
|
:columns '("Name" "ID")
|
|
|
|
:objects '(("Foo" 1034)
|
|
|
|
("Gazonk" 45))
|
|
|
|
:formatter (lambda (value column &rest _)
|
|
|
|
(if (= column 1)
|
|
|
|
(file-size-human-readable value)
|
|
|
|
value)))
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
In this case, that @samp{1034} will be displayed as @samp{1k}---but
|
|
|
|
will still sort after @samp{45}, because sorting is done on the actual
|
|
|
|
data, and not the displayed data.
|
|
|
|
|
|
|
|
Alternatively, instead of having a general formatter for the table,
|
|
|
|
you can instead put the formatter in the column definition:
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
(make-vtable
|
|
|
|
:columns '("Name"
|
|
|
|
(:name "ID" :formatter file-size-human-readable))
|
|
|
|
:objects '(("Foo" 1034)
|
|
|
|
("Gazonk" 45)))
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
The data doesn't have to be simple lists---you can give any type of
|
|
|
|
object to vtable, but then you also have to write a function that
|
|
|
|
returns the data for each column. For instance, here's a very simple
|
|
|
|
version of @kbd{M-x list-buffers}:
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
(make-vtable
|
|
|
|
:columns '("Name" "Size" "File")
|
|
|
|
:objects (buffer-list)
|
|
|
|
:actions '("k" kill-buffer
|
|
|
|
"RET" display-buffer)
|
|
|
|
:getter (lambda (object column vtable)
|
|
|
|
(pcase (vtable-column vtable column)
|
|
|
|
("Name" (buffer-name object))
|
|
|
|
("Size" (buffer-size object))
|
|
|
|
("File" (or (buffer-file-name object) "")))))
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
@var{objects} in this case is a list of buffers. To get the data to be
|
|
|
|
displayed, vtable calls the @dfn{getter} function, which is called for
|
|
|
|
each column of every object, and should return something suitable for
|
|
|
|
display.
|
|
|
|
|
|
|
|
Also note the @dfn{actions}: These are simple commands that will be
|
2022-02-19 13:34:01 +00:00
|
|
|
called with the object under point. So hitting @kbd{@key{RET}} on a line
|
2022-02-19 12:16:19 +00:00
|
|
|
will result in @code{display-buffer} being called with a buffer object
|
|
|
|
as the parameter. (You can also supply a keymap to be used, but then
|
|
|
|
you have to write commands that call @code{vtable-current-object} to
|
|
|
|
get at the object.)
|
|
|
|
|
|
|
|
Note that the actions aren't called with the data displayed in the
|
|
|
|
buffer---they're called with the original objects.
|
|
|
|
|
|
|
|
Finally, here's an example that uses just about all the features:
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
(make-vtable
|
|
|
|
:columns `(( :name "Thumb" :width "500px"
|
|
|
|
:displayer
|
|
|
|
,(lambda (value max-width table)
|
|
|
|
(propertize "*" 'display
|
|
|
|
(create-image value nil nil
|
|
|
|
:max-width max-width))))
|
|
|
|
(:name "Size" :width 10
|
|
|
|
:formatter file-size-human-readable)
|
|
|
|
(:name "Time" :width 10 :primary ascend :direction 'descend)
|
|
|
|
"Name")
|
|
|
|
:objects-function (lambda ()
|
|
|
|
(directory-files "~/pics/redslur/"
|
|
|
|
t "DSC0000[0-5].JPG"))
|
|
|
|
:actions '("RET" find-file)
|
|
|
|
:getter (lambda (object column table)
|
|
|
|
(pcase (vtable-column table column)
|
|
|
|
("Name" (file-name-nondirectory object))
|
|
|
|
("Thumb" object)
|
|
|
|
("Size" (file-attribute-size (file-attributes object)))
|
|
|
|
("Time" (format-time-string
|
|
|
|
"%F" (file-attribute-modification-time
|
|
|
|
(file-attributes object))))))
|
|
|
|
:separator-width 5
|
|
|
|
:keymap (define-keymap
|
|
|
|
"q" #'kill-buffer))
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
This vtable implements a simple image browser that displays image
|
|
|
|
thumbnails (that change sizes dynamically depending on the width of
|
|
|
|
the column), human-readable file sizes, date and file name. The
|
2022-02-19 13:34:01 +00:00
|
|
|
separator width is 5 typical characters wide. Hitting @kbd{@key{RET}} on a
|
2022-02-19 12:16:19 +00:00
|
|
|
line will open the image in a new window, and hitting @kbd{q} will
|
|
|
|
kill a buffer.
|
|
|
|
|
|
|
|
@node Concepts
|
|
|
|
@chapter Concepts
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@cindex vtable
|
2022-02-19 12:16:19 +00:00
|
|
|
A vtable lists data about a number of @dfn{objects}. Each object can
|
|
|
|
be a list or a vector, but it can also be anything else.
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@cindex getter of a vtable
|
2022-02-19 12:16:19 +00:00
|
|
|
To get the @dfn{value} for a particular column, the @dfn{getter}
|
|
|
|
function is called on the object. If no getter function is defined,
|
|
|
|
the default is to try to index the object as a sequence. In any case,
|
|
|
|
we end up with a value that is then used for sorting.
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@cindex formatter of a vtable
|
2022-02-19 12:16:19 +00:00
|
|
|
This value is then @dfn{formatted} via a @dfn{formatter} function,
|
|
|
|
which is called with the @dfn{value} as the argument. The formatter
|
|
|
|
commonly makes the value more reader friendly.
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@cindex displayer of a vtable
|
2022-02-19 12:16:19 +00:00
|
|
|
Finally, the formatted value is passed to the @dfn{displayer}
|
|
|
|
function, which is responsible for putting the table face on the
|
|
|
|
formatted value, and also ensuring that it's not wider than the column
|
|
|
|
width. The displayer will commonly truncate too-long strings and
|
|
|
|
scale image sizes.
|
|
|
|
|
|
|
|
All these three transforms, the getter, the formatter and the display
|
|
|
|
functions, can be defined on a per-column basis, and also on a
|
|
|
|
per-table basis. (The per-column transform takes precedence over the
|
|
|
|
per-table transform.)
|
|
|
|
|
|
|
|
User commands that are defined on a table does not work on the
|
|
|
|
displayed data. Instead they are called with the original object as
|
|
|
|
the argument.
|
|
|
|
|
|
|
|
@node Making A Table
|
|
|
|
@chapter Making A Table
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex make-vtable
|
2022-02-19 12:16:19 +00:00
|
|
|
The interface function for making (and optionally inserting a table
|
2022-02-19 13:34:01 +00:00
|
|
|
into a buffer) is @code{make-vtable}. It takes the following keyword
|
2022-02-19 12:16:19 +00:00
|
|
|
parameters:
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
@item :objects
|
|
|
|
This is a list of objects to be displayed. It should either be a list
|
|
|
|
of strings (which will then be displayed as a single-column table), or
|
|
|
|
a list where each element is a sequence containing a mixture of
|
2022-02-19 13:34:01 +00:00
|
|
|
strings, numbers, and other objects that can be displayed ``simply''.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
In the latter case, if @code{:columns} is non-@code{nil} and there's
|
|
|
|
more elements in the sequence than there is in @code{:columns}, only
|
2022-02-19 13:34:01 +00:00
|
|
|
the @code{:columns} first elements are displayed.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@item :objects-function
|
|
|
|
It's often convenient to generate the objects dynamically (for
|
|
|
|
instance, to make reversion work automatically). In that case, this
|
|
|
|
should be a function (which will be called with no arguments), and
|
|
|
|
should return a value as accepted as an @code{:objects} list.
|
|
|
|
|
|
|
|
@item :columns
|
|
|
|
This is a list where each element is either a string (the column
|
|
|
|
name), a plist of keyword/values (to make a @code{vtable-column}
|
|
|
|
object), or a full @code{vtable-column} object. A
|
|
|
|
@code{vtable-column} object has the following slots:
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
@item name
|
|
|
|
The name of the column.
|
|
|
|
|
|
|
|
@item width
|
|
|
|
The width of the column. This is either a number (the width of that
|
|
|
|
many @samp{x} characters in the table's face), or a string on the form
|
2022-02-19 13:34:01 +00:00
|
|
|
@samp{Xe@var{x}}, where @var{x} is a number of @samp{x} characters, or a
|
|
|
|
string on the form @samp{Xp@var{x}} (denoting a number of pixels), or a
|
2022-02-19 12:16:19 +00:00
|
|
|
string on the form @samp{X%} (a percentage of the window's width).
|
|
|
|
|
|
|
|
@item min-width
|
|
|
|
This uses the same format as @code{width}, but specifies the minimum
|
2022-02-19 13:34:01 +00:00
|
|
|
width (and overrides @code{width} if @code{width} is smaller than this.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@item max-width
|
|
|
|
This uses the same format as @code{width}, but specifies the maximum
|
2022-02-19 13:34:01 +00:00
|
|
|
width (and overrides @code{width} if @code{width} is larger than this.
|
2022-02-19 12:16:19 +00:00
|
|
|
@code{min-width}/@code{max-width} can be useful if @code{width} is
|
|
|
|
given as a percentage of the window width, and you want to ensure that
|
|
|
|
the column doesn't grow pointlessly large or unreadably narrow.
|
|
|
|
|
|
|
|
@item primary
|
|
|
|
Whether this is the primary column---this will be used for initial
|
|
|
|
sorting. This should be either @code{ascend} or @code{descend} to say
|
2022-02-19 13:34:01 +00:00
|
|
|
in which order the table should be sorted.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@item getter
|
|
|
|
If present, this function will be called to return the column value.
|
|
|
|
|
|
|
|
@defun column-getter object table
|
2022-02-19 13:34:01 +00:00
|
|
|
It's called with two parameters: the object and the table.
|
2022-02-19 12:16:19 +00:00
|
|
|
@end defun
|
|
|
|
|
|
|
|
@item formatter
|
|
|
|
If present, this function will be called to format the value.
|
|
|
|
|
|
|
|
@defun column-formatter value
|
2022-02-19 13:34:01 +00:00
|
|
|
It's called with one parameter: the column value.
|
2022-02-19 12:16:19 +00:00
|
|
|
@end defun
|
|
|
|
|
|
|
|
@item displayer
|
|
|
|
If present, this function will be called to prepare the formatted
|
|
|
|
value for display. This function should return a string with the
|
|
|
|
table face applied, and also limit the width of the string to the
|
|
|
|
display width.
|
|
|
|
|
|
|
|
@defun column-displayer fvalue max-width table
|
|
|
|
@var{fvalue} is the formatted value; @var{max-width} is the maximum
|
|
|
|
width (in pixels), and @var{table} is the table.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@item align
|
|
|
|
Should be either @code{right} or @code{left}.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
@item :getter
|
|
|
|
If given, this is a function that should return the values to use in
|
|
|
|
the table, and will be called once for each element in the table
|
|
|
|
(unless overridden by a column getter function).
|
|
|
|
|
|
|
|
@defun getter object index table
|
2022-02-19 13:34:01 +00:00
|
|
|
@c FIXME: Describe the arguments.
|
2022-02-19 12:16:19 +00:00
|
|
|
For a simple object (like a sequence), this function will typically
|
2022-02-19 13:34:01 +00:00
|
|
|
just return the element corresponding to the column index (zero-based), but the
|
2022-02-19 12:16:19 +00:00
|
|
|
function can do any computation it wants. If it's more convenient to
|
|
|
|
write the function based on column names rather than the column index,
|
|
|
|
the @code{vtable-column} function can be used to map from index to name.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@item :formatter
|
|
|
|
If present, this is a function that should format the value, and it
|
|
|
|
will be called on all values in the table (unless overridden by a
|
|
|
|
column formatter).
|
|
|
|
|
|
|
|
@defun formatter value index table
|
2022-02-19 13:34:01 +00:00
|
|
|
@c FIXME: The arguments are named, but not explained. E.g., what is TABLE?
|
|
|
|
This function is called with three parameters: the value (as returned
|
2022-02-19 12:16:19 +00:00
|
|
|
by the getter); the column index, and the table. It can return any
|
|
|
|
value.
|
|
|
|
|
|
|
|
This can be used to (for instance) format numbers in a human-readable
|
|
|
|
form.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@item :displayer
|
|
|
|
Before displaying an element, it's passed to the displaying function
|
|
|
|
(if any).
|
|
|
|
|
|
|
|
@defun displayer fvalue index max-width table
|
2022-02-19 13:34:01 +00:00
|
|
|
This is called with four arguments: the formatted value of the element
|
2022-02-19 12:16:19 +00:00
|
|
|
(as returned by the formatter function); the column index; the display
|
|
|
|
width (in pixels); and the table.
|
|
|
|
|
|
|
|
This function should return a string with the table face applied, and
|
|
|
|
truncated to the display width.
|
|
|
|
|
|
|
|
This can be used to (for instance) change the size of images that are
|
|
|
|
displayed in the table.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@item :use-header-line
|
2022-02-19 13:34:01 +00:00
|
|
|
If non-@code{nil} (which is the default), display the column names on
|
|
|
|
the header line. This is the most common use
|
2022-02-19 12:16:19 +00:00
|
|
|
case, but if there's other text in the buffer before the table, or
|
|
|
|
there are several tables in the same buffer, then this should be
|
|
|
|
@code{nil}.
|
|
|
|
|
|
|
|
@item :face
|
|
|
|
The face to be used. This defaults to @code{variable-pitch}. This
|
2022-02-19 13:34:01 +00:00
|
|
|
face doesn't override the faces in the data, or the faces supplied by
|
|
|
|
the getter and formatter functions.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@item :actions
|
|
|
|
This uses the same syntax as @code{define-keymap}, but doesn't refer
|
|
|
|
to commands directly. Instead each key is bound to a command that
|
|
|
|
picks out the current object, and then calls the function specified
|
|
|
|
with that as the argument.
|
|
|
|
|
|
|
|
@item :keymap
|
|
|
|
This is a keymap used on the table. The commands here are called as
|
|
|
|
usual, and if they're supposed to work on the object displayed on the
|
|
|
|
current line, they can use the @code{vtable-current-object} function
|
2022-02-19 13:34:01 +00:00
|
|
|
(@pxref{Interface Functions}) to determine what that object is.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@item :separator-width
|
2022-02-19 13:34:01 +00:00
|
|
|
The width of the blank space between columns.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@item :sort-by
|
|
|
|
This should be a list of tuples, and specifies how the table is to be
|
|
|
|
sorted. Each tuple should consist of an integer (the column index)
|
|
|
|
and either @code{ascend} or @code{descend}.
|
|
|
|
|
|
|
|
The table is first sorted by the first element in this list, and then
|
|
|
|
the next, until the end is reached.
|
|
|
|
|
|
|
|
@item :ellipsis
|
|
|
|
By default, when shortening displayed values, an ellipsis will be
|
|
|
|
shown. If this is @code{nil}, no ellipsis is shown. (The text to use
|
|
|
|
as the ellipsis is determined by the @code{truncate-string-ellipsis}
|
|
|
|
function.)
|
|
|
|
|
|
|
|
@findex vtable-insert
|
|
|
|
@item :insert
|
|
|
|
By default, @code{make-vtable} will insert the table at point. If this
|
|
|
|
is @code{nil}, nothing is inserted, but the vtable object is returned,
|
|
|
|
and you can insert it later with the @code{vtable-insert} function.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
@node Commands
|
|
|
|
@chapter Commands
|
2022-02-19 13:34:01 +00:00
|
|
|
@cindex vtable commands
|
|
|
|
|
|
|
|
@c FIXME: Some introductory text is in order? Commands where?
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@table @kbd
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex vtable-sort-by-current-column
|
2022-02-19 12:16:19 +00:00
|
|
|
@item S
|
|
|
|
Sort the table by the current column
|
|
|
|
(@code{vtable-sort-by-current-column}). Note that the table is sorted
|
2022-02-19 13:34:01 +00:00
|
|
|
according to the data returned by the getter function (@pxref{Making A
|
|
|
|
Table}), not by how it's
|
2022-02-19 12:16:19 +00:00
|
|
|
displayed in the buffer. Columns that have only numerical data is
|
|
|
|
sorted as numbers, the rest are sorted as strings.
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex vtable-narrow-current-column
|
2022-02-19 12:16:19 +00:00
|
|
|
@item @{
|
|
|
|
Make the current column narrower
|
|
|
|
(@code{vtable-narrow-current-column}).
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex vtable-widen-current-column
|
2022-02-19 12:16:19 +00:00
|
|
|
@item @}
|
|
|
|
Make the current column wider
|
|
|
|
(@code{vtable-widen-current-column}).
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex vtable-previous-column
|
2022-02-19 12:16:19 +00:00
|
|
|
@item M-<left>
|
|
|
|
Move to the previous column (@code{vtable-previous-column}).
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex vtable-next-column
|
2022-02-19 12:16:19 +00:00
|
|
|
@item M-<right>
|
|
|
|
Move to the next column (@code{vtable-next-column}).
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
@findex vtable-revert-command
|
2022-02-19 12:16:19 +00:00
|
|
|
@item g
|
|
|
|
Regenerate the table (@code{vtable-revert-command}). This command
|
|
|
|
mostly makes sense if the table has a @code{:objects-function} that
|
|
|
|
can fetch new data.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
@node Interface Functions
|
|
|
|
@chapter Interface Functions
|
|
|
|
|
2022-02-19 13:34:01 +00:00
|
|
|
If you need to write a mode based on vtable, you will have to interact
|
|
|
|
with the table in
|
|
|
|
various ways---for instance, you'll need to write commands that
|
|
|
|
updates an object
|
|
|
|
and then displays the result. This chapter describes functions for
|
|
|
|
such interaction.
|
2022-02-19 12:16:19 +00:00
|
|
|
|
|
|
|
@defun vtable-current-table
|
|
|
|
This function returns the table under point.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-current-object
|
|
|
|
This function returns the object on the current line. (Note that this
|
2022-02-19 13:34:01 +00:00
|
|
|
is the original object, not the characters displayed in the
|
2022-02-19 12:16:19 +00:00
|
|
|
buffer.)
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-current-column
|
|
|
|
This function returns the column index of the column under point.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-goto-table table
|
|
|
|
Move point to the start of @var{table} and return the position. If
|
|
|
|
@var{table} can't be found in the current buffer, don't move point and
|
|
|
|
return @code{nil}.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-goto-object object
|
|
|
|
Move point to the start of the line where @var{object} is displayed in
|
2022-02-19 13:34:01 +00:00
|
|
|
the current table and return the position. If @var{object} can't be found,
|
2022-02-19 12:16:19 +00:00
|
|
|
don't move point and return @code{nil}.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-goto-column index
|
|
|
|
Move point to the start of the @var{index}th column. (The first
|
|
|
|
column is numbered zero.)
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-beginning-of-table
|
|
|
|
Move to the beginning of the current table.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-end-of-table
|
|
|
|
Move to the end of the current table.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-remove-object table object
|
|
|
|
Remove @var{object} from @var{table}. This also updates the displayed
|
|
|
|
table.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-insert-object table object &optional after-object
|
|
|
|
Insert @var{object} into @var{table}. If @var{after-object}, insert
|
|
|
|
the object after this object; otherwise append to @var{table}. This
|
|
|
|
also updates the displayed table.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-update-object table object old-object
|
|
|
|
Change @var{old-object} into @var{object} in @var{table}. This also
|
|
|
|
updates the displayed table.
|
|
|
|
|
|
|
|
This has the same effect as calling @code{vtable-remove-object} and
|
|
|
|
then @code{vtable-insert-object}, but is more efficient.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@defun vtable-column table index
|
|
|
|
Return the column name of the @var{index}th column in @var{table}.
|
|
|
|
@end defun
|
|
|
|
|
|
|
|
@node GNU Free Documentation License
|
|
|
|
@chapter GNU Free Documentation License
|
|
|
|
@include doclicense.texi
|
|
|
|
|
|
|
|
@node Index
|
|
|
|
@unnumbered Index
|
|
|
|
@printindex cp
|
|
|
|
|
|
|
|
@bye
|