diff options
| author | Lars Ingebrigtsen | 2016-03-04 13:39:07 +0000 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-03-04 15:33:38 +0000 |
| commit | 2d5b20f68c194e7fec7b9602935fd95149e9b7c6 (patch) | |
| tree | 4dc995ec41e242f4f0c2d431bcd129a5e2c40410 /doc | |
| parent | 484967796755051c4045cdcc26b0d3d129cc72ad (diff) | |
| download | emacs-2d5b20f68c194e7fec7b9602935fd95149e9b7c6.tar.gz emacs-2d5b20f68c194e7fec7b9602935fd95149e9b7c6.zip | |
Add accessors for `file-attributes'
* doc/lispref/files.texi (File Attributes): Mention the accessors.
* lisp/files.el (file-attribute-type)
(file-attribute-link-number, file-attribute-user-id)
(file-attribute-group-id, file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-change-time, file-attribute-size)
(file-attribute-modes, file-attribute-inode-number)
(file-attribute-device-number): New functions.
* src/dired.c (Ffile_attributes): Mention the accessors (bug#22890).
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/files.texi | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 6b7ee19d5f3..8a6cb7beaad 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi | |||
| @@ -1195,73 +1195,83 @@ the default, but we plan to change that, so you should specify a | |||
| 1195 | non-@code{nil} value for @var{id-format} if you use the returned | 1195 | non-@code{nil} value for @var{id-format} if you use the returned |
| 1196 | @acronym{UID} or @acronym{GID}. | 1196 | @acronym{UID} or @acronym{GID}. |
| 1197 | 1197 | ||
| 1198 | Accessor functions are provided to access the elements in this list. | ||
| 1199 | The accessors are mentioned along with the descriptions of the | ||
| 1200 | elements below. | ||
| 1201 | |||
| 1198 | The elements of the list, in order, are: | 1202 | The elements of the list, in order, are: |
| 1199 | 1203 | ||
| 1200 | @enumerate 0 | 1204 | @enumerate 0 |
| 1201 | @item | 1205 | @item |
| 1202 | @code{t} for a directory, a string for a symbolic link (the name | 1206 | @code{t} for a directory, a string for a symbolic link (the name |
| 1203 | linked to), or @code{nil} for a text file. | 1207 | linked to), or @code{nil} for a text file |
| 1208 | (@code{file-attribute-type}). | ||
| 1204 | 1209 | ||
| 1205 | @c Wordy so as to prevent an overfull hbox. --rjc 15mar92 | 1210 | @c Wordy so as to prevent an overfull hbox. --rjc 15mar92 |
| 1206 | @item | 1211 | @item |
| 1207 | The number of names the file has. Alternate names, also known as hard | 1212 | The number of names the file has (@code{file-attribute-link-number}). |
| 1208 | links, can be created by using the @code{add-name-to-file} function | 1213 | Alternate names, also known as hard links, can be created by using the |
| 1209 | (@pxref{Changing Files}). | 1214 | @code{add-name-to-file} function (@pxref{Changing Files}). |
| 1210 | 1215 | ||
| 1211 | @item | 1216 | @item |
| 1212 | The file's @acronym{UID}, normally as a string. However, if it does | 1217 | The file's @acronym{UID}, normally as a string |
| 1213 | not correspond to a named user, the value is a number. | 1218 | (@code{file-attribute-user-id}). However, if it does not correspond |
| 1219 | to a named user, the value is a number. | ||
| 1214 | 1220 | ||
| 1215 | @item | 1221 | @item |
| 1216 | The file's @acronym{GID}, likewise. | 1222 | The file's @acronym{GID}, likewise (@code{file-attribute-group-id}). |
| 1217 | 1223 | ||
| 1218 | @item | 1224 | @item |
| 1219 | The time of last access, as a list of four integers @code{(@var{sec-high} | 1225 | The time of last access, as a list of four integers |
| 1220 | @var{sec-low} @var{microsec} @var{picosec})}. (This is similar to the | 1226 | @code{(@var{sec-high} @var{sec-low} @var{microsec} @var{picosec})} |
| 1221 | value of @code{current-time}; see @ref{Time of Day}.) Note that on | 1227 | (@code{file-attribute-access-time}). (This is similar to the value of |
| 1222 | some FAT-based filesystems, only the date of last access is recorded, | 1228 | @code{current-time}; see @ref{Time of Day}.) Note that on some |
| 1223 | so this time will always hold the midnight of the day of last access. | 1229 | FAT-based filesystems, only the date of last access is recorded, so |
| 1230 | this time will always hold the midnight of the day of last access. | ||
| 1224 | 1231 | ||
| 1225 | @cindex modification time of file | 1232 | @cindex modification time of file |
| 1226 | @item | 1233 | @item |
| 1227 | The time of last modification as a list of four integers (as above). | 1234 | The time of last modification as a list of four integers (as above) |
| 1228 | This is the last time when the file's contents were modified. | 1235 | (@code{file-attribute-modification-time}). This is the last time when |
| 1236 | the file's contents were modified. | ||
| 1229 | 1237 | ||
| 1230 | @item | 1238 | @item |
| 1231 | The time of last status change as a list of four integers (as above). | 1239 | The time of last status change as a list of four integers (as above) |
| 1232 | This is the time of the last change to the file's access mode bits, | 1240 | (code{file-attribute-status-change-time}). This is the time of the |
| 1233 | its owner and group, and other information recorded in the filesystem | 1241 | last change to the file's access mode bits, its owner and group, and |
| 1234 | for the file, beyond the file's contents. | 1242 | other information recorded in the filesystem for the file, beyond the |
| 1243 | file's contents. | ||
| 1235 | 1244 | ||
| 1236 | @item | 1245 | @item |
| 1237 | The size of the file in bytes. This is floating point if the size is | 1246 | The size of the file in bytes (@code{file-attribute-size}). This is |
| 1238 | too large to fit in a Lisp integer. | 1247 | floating point if the size is too large to fit in a Lisp integer. |
| 1239 | 1248 | ||
| 1240 | @item | 1249 | @item |
| 1241 | The file's modes, as a string of ten letters or dashes, | 1250 | The file's modes, as a string of ten letters or dashes, as in |
| 1242 | as in @samp{ls -l}. | 1251 | @samp{ls -l} (@code{file-attribute-modes}). |
| 1243 | 1252 | ||
| 1244 | @item | 1253 | @item |
| 1245 | An unspecified value, present for backward compatibility. | 1254 | An unspecified value, present for backward compatibility. |
| 1246 | 1255 | ||
| 1247 | @item | 1256 | @item |
| 1248 | The file's inode number. If possible, this is an integer. If the | 1257 | The file's inode number (@code{file-attribute-inode-number}). If |
| 1249 | inode number is too large to be represented as an integer in Emacs | 1258 | possible, this is an integer. If the inode number is too large to be |
| 1250 | Lisp but dividing it by @math{2^{16}} yields a representable integer, | 1259 | represented as an integer in Emacs Lisp but dividing it by |
| 1251 | then the value has the | 1260 | @math{2^{16}} yields a representable integer, then the value has the |
| 1252 | form @code{(@var{high} . @var{low})}, where @var{low} holds the low 16 | 1261 | form @code{(@var{high} . @var{low})}, where @var{low} holds the low 16 |
| 1253 | bits. If the inode number is too wide for even that, the value is of the form | 1262 | bits. If the inode number is too wide for even that, the value is of |
| 1254 | @code{(@var{high} @var{middle} . @var{low})}, where @code{high} holds | 1263 | the form @code{(@var{high} @var{middle} . @var{low})}, where |
| 1255 | the high bits, @var{middle} the middle 24 bits, and @var{low} the low | 1264 | @code{high} holds the high bits, @var{middle} the middle 24 bits, and |
| 1256 | 16 bits. | 1265 | @var{low} the low 16 bits. |
| 1257 | 1266 | ||
| 1258 | @item | 1267 | @item |
| 1259 | The filesystem number of the device that the file is on. Depending on | 1268 | The filesystem number of the device that the file is on |
| 1260 | the magnitude of the value, this can be either an integer or a cons | 1269 | @code{file-attribute-device-number}). Depending on the magnitude of |
| 1261 | cell, in the same manner as the inode number. This element and the | 1270 | the value, this can be either an integer or a cons cell, in the same |
| 1262 | file's inode number together give enough information to distinguish | 1271 | manner as the inode number. This element and the file's inode number |
| 1263 | any two files on the system---no two files can have the same values | 1272 | together give enough information to distinguish any two files on the |
| 1264 | for both of these numbers. | 1273 | system---no two files can have the same values for both of these |
| 1274 | numbers. | ||
| 1265 | @end enumerate | 1275 | @end enumerate |
| 1266 | 1276 | ||
| 1267 | For example, here are the file attributes for @file{files.texi}: | 1277 | For example, here are the file attributes for @file{files.texi}: |