emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-26 99f92da: Improve documentation of 'directory-files-and-attr


From: Lars Ingebrigtsen
Subject: Re: emacs-26 99f92da: Improve documentation of 'directory-files-and-attributes'
Date: Fri, 01 Jun 2018 12:21:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

address@hidden (Eli Zaretskii) writes:

> +Value is a list of the form:
> +
> +  ((FILE1 FILE1-ATTRS) (FILE2 FILE2-ATTRS) ...)
> +
> +where each FILEn-ATTRS is the attributes of FILEn as returned
> +by `file-attributes'.

Heh, I read the same reddit post, apparently, and fixed it like this on
master: 

+The list returned has elements that contain the data from
+`file-attributes' for each file -- with the file name prepended.  So
+the structure of each element is
+`(FILE-NAME FILE-ATTRIBUTE1 FILE-ATTRIBUTE2 ...)'.
+
+For instance, to get the size of the fourth element in a directory,
+you could say:
+
+  (file-attribute-size (cdr (nth 3 (directory-files-and-attributes "/"))))
+

Because (FILE1 FILE1-ATTRS) is a bit ambiguous, since it could mean

("file-name" (t 27 0 0 (23311 56666 366991 953000) (23220 586 761023 102000) 
(23220 586 761023 102000) 4096 "drwxr-xr-x" t 2 66306))

instead of

("file-name" t 27 0 0 (23311 56666 366991 953000) (23220 586 761023 102000) 
(23220 586 761023 102000) 4096 "drwxr-xr-x" t 2 66306)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]