unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: `file-attribute' accessors
Date: Mon, 09 Apr 2012 16:19:38 +0200	[thread overview]
Message-ID: <87aa2lgf7p.fsf@gmail.com> (raw)
In-Reply-To: m37gxp6mb7.fsf@stories.gnus.org

Lars Magne Ingebrigtsen <larsi@gnus.org> 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	other threads:[~2012-04-09 14:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 13:56 `file-attribute' accessors Lars Magne Ingebrigtsen
2012-04-09 14:19 ` Thierry Volpiatto [this message]
2012-04-09 14:40   ` Lars Magne Ingebrigtsen
2012-04-09 14:53     ` Thierry Volpiatto
2012-04-09 15:46     ` Ted Zlatanov
2012-04-09 16:29       ` Lars Magne Ingebrigtsen
2012-04-09 16:32       ` Stefan Monnier
2012-04-09 16:52         ` Ted Zlatanov
2012-04-10  1:48           ` Stefan Monnier
2012-04-11  1:55           ` Miles Bader
2012-04-09 15:32 ` Leo
2012-04-09 16:31   ` Stefan Monnier
2012-04-09 17:08     ` Drew Adams
2012-04-10  1:47       ` Stefan Monnier
2012-04-10 10:58         ` Thien-Thi Nguyen
2012-04-10 12:52           ` Stefan Monnier
2012-04-09 17:57     ` Leo
2012-04-09 16:33 ` Stefan Monnier
2012-04-09 17:35   ` Lars Magne Ingebrigtsen
2012-04-10  1:50     ` Stefan Monnier
2012-04-10  2:00       ` Lars Magne Ingebrigtsen
2012-04-10 12:56         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aa2lgf7p.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).