diff options
| author | Lars Ingebrigtsen <larsi@gnus.org> | 2016-03-04 13:39:07 +0000 |
|---|---|---|
| committer | Lars Ingebrigtsen <larsi@gnus.org> | 2016-03-04 15:33:38 +0000 |
| commit | 2d5b20f68c194e7fec7b9602935fd95149e9b7c6 (patch) | |
| tree | 4dc995ec41e242f4f0c2d431bcd129a5e2c40410 /lisp | |
| parent | 484967796755051c4045cdcc26b0d3d129cc72ad (diff) | |
| download | emacs-2d5b20f68c194e7fec7b9602935fd95149e9b7c6.tar.gz | |
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 'lisp')
| -rw-r--r-- | lisp/files.el | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index aca7b3593d9..c892ab4e219 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7083,6 +7083,78 @@ Otherwise, trash FILENAME using the freedesktop.org conventions, (let ((delete-by-moving-to-trash nil)) (rename-file fn new-fn))))))))) +(defsubst file-attribute-type (attributes) + "The type field in ATTRIBUTES returned by `file-attribute'. +The value is either t for directory, string (name linked to) for +symbolic link, or nil." + (nth 0 attributes)) + +(defsubst file-attribute-link-number (attributes) + "Return the number of links in ATTRIBUTES returned by `file-attribute'." + (nth 1 attributes)) + +(defsubst file-attribute-user-id (attributes) + "The UID field in ATTRIBUTES returned by `file-attribute'. +This is either a string or a number. If a string value cannot be +looked up, a numeric value, either an integer or a float, is +returned." + (ntf 2 attributes)) + +(defsubst file-attribute-group-id (attributes) + "The GID field in ATTRIBUTES returned by `file-attribute'. +This is either a string or a number. If a string value cannot be +looked up, a numeric value, either an integer or a float, is +returned." + (ntf 3 attributes)) + +(defsubst file-attribute-access-time (attributes) + "The last access time in ATTRIBUTES returned by `file-attribute'. +This a list of integers (HIGH LOW USEC PSEC) in the same style +as (current-time)." + (ntf 4 attributes)) + +(defsubst file-attribute-modification-time (attributes) + "The modification time in ATTRIBUTES returned by `file-attribute'. +This is the time of the last change to the file's contents, and +is a list of integers (HIGH LOW USEC PSEC) in the same style +as (current-time)." + (ntf 5 attributes)) + +(defsubst file-attribute-status-change-time (attributes) + "The status modification time in ATTRIBUTES returned by `file-attribute'. +This is the time of last change to the file's attributes: owner +and group, access mode bits, etc, and is a list of integers (HIGH +LOW USEC PSEC) in the same style as (current-time)." + (ntf 6 attributes)) + +(defsubst file-attribute-size (attributes) + "The size (in bytes) in ATTRIBUTES returned by `file-attribute'. +This is a floating point number if the size is too large for an integer." + (ntf 7 attributes)) + +(defsubst file-attribute-modes (attributes) + "The file modes in ATTRIBUTES returned by `file-attribute'. +This is a string of ten letters or dashes as in ls -l." + (ntf 8 attributes)) + +(defsubst file-attribute-inode-number (attributes) + "The inode number in ATTRIBUTES returned by `file-attribute'. +If it is larger than what an Emacs integer can hold, this is of +the form (HIGH . LOW): first the high bits, then the low 16 bits. +If even HIGH is too large for an Emacs integer, this is instead +of the form (HIGH MIDDLE . LOW): first the high bits, then the +middle 24 bits, and finally the low 16 bits." + (ntf 10 attributes)) + +(defsubst file-attribute-device-number (attributes) + "The file system device number in ATTRIBUTES returned by `file-attribute'. +If it is larger than what an Emacs integer can hold, this is of +the form (HIGH . LOW): first the high bits, then the low 16 bits. +If even HIGH is too large for an Emacs integer, this is instead +of the form (HIGH MIDDLE . LOW): first the high bits, then the +middle 24 bits, and finally the low 16 bits." + (ntf 11 attributes)) + (define-key ctl-x-map "\C-f" 'find-file) (define-key ctl-x-map "\C-r" 'find-file-read-only) |
