emacs-devel
[Top][All Lists]
Advanced

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

Re: `file-attribute' accessors


From: Thierry Volpiatto
Subject: Re: `file-attribute' accessors
Date: Mon, 09 Apr 2012 16:19:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> writes:

> I was reading code that said `(nth 7 (file-attributes file-name))', and
> I had to look up the doc string of `file-attributes' and find item seven
> to understand what the code was trying to do.
>
> Wouldn't it be nice if we had accessor functions for these things
> instead of making people write `nth 7'?  If the code said
> `(file-attribute-size (file-attributes file-name))', that would have
> made things more understandable.  (And probably easier to write, too,
> since one wouldn't have to consult the `file-attributes' doc string
> every time...)
Why not keys instead of many accessor functions?

See `helm-file-attributes' in helm-utils.el at
https://github.com/emacs-helm/helm

(helm-file-attributes "~/.emacs.d/emacs-config-laptop/.emacs.el" :size t)
=>62675
(helm-file-attributes "~/.emacs.d/emacs-config-laptop/.emacs.el" :human-size t)
=>"61.2K"

> If this sounds OK, I can add the, erm, 11 trivial accessor functions and
> adjust the documentation of `file-attributes' in trunk.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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