diff options
| author | Lars Ingebrigtsen | 2022-02-19 16:58:52 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-02-19 16:58:52 +0100 |
| commit | a72e0e50f0afbb8b37b9ebd8e1fa83ce3eb9f643 (patch) | |
| tree | 5df7427640e2956dbb18a6abf45828d7d9176155 /doc/misc | |
| parent | 9f571a2e6c1cf0f039438093a28ee2a962658fd5 (diff) | |
| download | emacs-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.texi | 17 |
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 | ||
| 91 | By default, vtable uses the @code{variable-pitch} font, and | 91 | By default, vtable uses the @code{variable-pitch} font, and |
| 92 | right-aligns columns that only have numerical data (and left-aligns | 92 | right-aligns columns that have only numerical data (and left-aligns |
| 93 | the rest). | 93 | the rest). |
| 94 | 94 | ||
| 95 | You'd normally want to name the columns: | 95 | You'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 | ||
| 104 | Clicking on the column names will sort the table based on the data in | 104 | Clicking on the column names will sort the table based on the data in |
| 105 | each object (and in this example, each object is just a simple list). | 105 | each column (which, in this example, corresponds to an element in a |
| 106 | list). | ||
| 106 | 107 | ||
| 107 | By default, the data is displayed ``as is'', that is, the way | 108 | By 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 | |||
| 123 | data, and not the displayed data. | 124 | data, and not the displayed data. |
| 124 | 125 | ||
| 125 | Alternatively, instead of having a general formatter for the table, | 126 | Alternatively, instead of having a general formatter for the table, |
| 126 | you can instead put the formatter in the column definition: | 127 | you 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 |
| 155 | displayed, vtable calls the @dfn{getter} function, which is called for | 156 | be displayed, vtable calls the @dfn{getter} function, which is called |
| 156 | each column of every object, and should return something suitable for | 157 | for each column of every object, and which should return the data that |
| 157 | display. | 158 | will eventually be displayed. |
| 158 | 159 | ||
| 159 | Also note the @dfn{actions}: These are simple commands that will be | 160 | Also note the @dfn{actions}: These are simple commands that will be |
| 160 | called with the object under point. So hitting @kbd{@key{RET}} on a line | 161 | called 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\\'")) |