Subject: bug#22890: 25.1.50; Wishlist: There should be file-attribute accessors

From: Andy Moreton <[email-masked]>
Date: Fri, 04 Mar 2016 16:17:54 +0000

On Fri 04 Mar 2016, Lars Ingebrigtsen wrote:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> `file-attributes' returns a list of data, and you very often see code
>> like
>>
>> (let ((atts (file-attributes file)))
>>   (when (> (elt atts 7) 4000)
>>     ...))
>>
>> and you have no idea what that means.  So I think there should be 12
>> attribute accessor functions (well, defsubsts) that people can use
>> instead.  The names could be something like `file-attribute-size',
>> `file-attribute-access-time', etc.
>
> I've now implemented this on the trunk.

A useful addition. Please fix the defsubst typos (ntf -> nth) and
possibly add some tests.

Consider also fixing file-attributes callers to use the new accessors.

    AndyM