aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-02-19 16:58:52 +0100
committerLars Ingebrigtsen2022-02-19 16:58:52 +0100
commita72e0e50f0afbb8b37b9ebd8e1fa83ce3eb9f643 (patch)
tree5df7427640e2956dbb18a6abf45828d7d9176155 /doc/misc
parent9f571a2e6c1cf0f039438093a28ee2a962658fd5 (diff)
downloademacs-a72e0e50f0afbb8b37b9ebd8e1fa83ce3eb9f643.tar.gz
emacs-a72e0e50f0afbb8b37b9ebd8e1fa83ce3eb9f643.zip
Some vtable.texi copy edits
* doc/misc/vtable.texi (Making A Table): Mention the accessors.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/vtable.texi17
1 files changed, 9 insertions, 8 deletions
diff --git a/doc/misc/vtable.texi b/doc/misc/vtable.texi
index 8e6db5659d0..472dee70ec0 100644
--- a/doc/misc/vtable.texi
+++ b/doc/misc/vtable.texi
@@ -89,7 +89,7 @@ Here's just about the simplest vtable that can be created:
89@end lisp 89@end lisp
90 90
91By default, vtable uses the @code{variable-pitch} font, and 91By default, vtable uses the @code{variable-pitch} font, and
92right-aligns columns that only have numerical data (and left-aligns 92right-aligns columns that have only numerical data (and left-aligns
93the rest). 93the rest).
94 94
95You'd normally want to name the columns: 95You'd normally want to name the columns:
@@ -102,7 +102,8 @@ You'd normally want to name the columns:
102@end lisp 102@end lisp
103 103
104Clicking on the column names will sort the table based on the data in 104Clicking on the column names will sort the table based on the data in
105each object (and in this example, each object is just a simple list). 105each column (which, in this example, corresponds to an element in a
106list).
106 107
107By default, the data is displayed ``as is'', that is, the way 108By default, the data is displayed ``as is'', that is, the way
108@samp{(format "%s" ...)} would display it, but you can override that. 109@samp{(format "%s" ...)} would display it, but you can override that.
@@ -123,7 +124,7 @@ will still sort after @samp{45}, because sorting is done on the actual
123data, and not the displayed data. 124data, and not the displayed data.
124 125
125Alternatively, instead of having a general formatter for the table, 126Alternatively, instead of having a general formatter for the table,
126you can instead put the formatter in the column definition: 127you can put the formatter in the column definition:
127 128
128@lisp 129@lisp
129(make-vtable 130(make-vtable
@@ -151,10 +152,10 @@ version of @kbd{M-x list-buffers}:
151 ("File" (or (buffer-file-name object) ""))))) 152 ("File" (or (buffer-file-name object) "")))))
152@end lisp 153@end lisp
153 154
154@var{objects} in this case is a list of buffers. To get the data to be 155@var{objects} in this case is a list of buffers. To get the data to
155displayed, vtable calls the @dfn{getter} function, which is called for 156be displayed, vtable calls the @dfn{getter} function, which is called
156each column of every object, and should return something suitable for 157for each column of every object, and which should return the data that
157display. 158will eventually be displayed.
158 159
159Also note the @dfn{actions}: These are simple commands that will be 160Also note the @dfn{actions}: These are simple commands that will be
160called with the object under point. So hitting @kbd{@key{RET}} on a line 161called with the object under point. So hitting @kbd{@key{RET}} on a line
@@ -178,7 +179,7 @@ Finally, here's an example that uses just about all the features:
178 :max-width max-width)))) 179 :max-width max-width))))
179 (:name "Size" :width 10 180 (:name "Size" :width 10
180 :formatter file-size-human-readable) 181 :formatter file-size-human-readable)
181 (:name "Time" :width 10 :primary ascend :direction 'descend) 182 (:name "Time" :width 10 :primary ascend)
182 "Name") 183 "Name")
183 :objects-function (lambda () 184 :objects-function (lambda ()
184 (directory-files "/tmp/" t "\\.jpg\\'")) 185 (directory-files "/tmp/" t "\\.jpg\\'"))