unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Use file-attributes accesors in existing code
@ 2016-07-28 14:53 Tino Calancha
  2016-07-28 17:23 ` Ted Zlatanov
  2016-07-28 17:35 ` Michael Albinus
  0 siblings, 2 replies; 3+ messages in thread
From: Tino Calancha @ 2016-07-28 14:53 UTC (permalink / raw)
  To: emacs-devel


Dear all,

as you know in Emacs 25.2 we have accessors for each of
the values returned by 'file-attributes'.  These accessors
prevent from some hardcoded numbers in the code, that is,
write:
(file-attribute-size attr)
instead of:
(nth 5 attr)

I guess everyone would like to use these accesors in future code.

Is it worth to review the existing code, in a case by
case basis, to see where the use of these accesors may result in a
more readable code?

I am glad to carry this task in case the maintainers think is
useful.

How about another accesor returning a list (inode device)?
How to call it?
Is is too long 'file-attribute-inode-device-numbers'?

Regards,
Tino



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Use file-attributes accesors in existing code
  2016-07-28 14:53 Use file-attributes accesors in existing code Tino Calancha
@ 2016-07-28 17:23 ` Ted Zlatanov
  2016-07-28 17:35 ` Michael Albinus
  1 sibling, 0 replies; 3+ messages in thread
From: Ted Zlatanov @ 2016-07-28 17:23 UTC (permalink / raw)
  To: emacs-devel

On Thu, 28 Jul 2016 23:53:23 +0900 (JST) Tino Calancha <tino.calancha@gmail.com> wrote: 

TC> as you know in Emacs 25.2 we have accessors for each of
TC> the values returned by 'file-attributes'.  These accessors
TC> prevent from some hardcoded numbers in the code, that is,
TC> write:
TC> (file-attribute-size attr)
TC> instead of:
TC> (nth 5 attr)

TC> Is it worth to review the existing code, in a case by
TC> case basis, to see where the use of these accesors may result in a
TC> more readable code?

TC> I am glad to carry this task in case the maintainers think is
TC> useful.

As a fellow developer, I think that makes sense, and hope the
maintainers agree.

TC> How about another accesor returning a list (inode device)?
TC> How to call it?
TC> Is is too long 'file-attribute-inode-device-numbers'?

I'd use something like this:

(file-attribute-collect attr 'inode 'device)

Ted




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Use file-attributes accesors in existing code
  2016-07-28 14:53 Use file-attributes accesors in existing code Tino Calancha
  2016-07-28 17:23 ` Ted Zlatanov
@ 2016-07-28 17:35 ` Michael Albinus
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Albinus @ 2016-07-28 17:35 UTC (permalink / raw)
  To: Tino Calancha; +Cc: emacs-devel

Tino Calancha <tino.calancha@gmail.com> writes:

> Dear all,

Hi Tino,

> Is it worth to review the existing code, in a case by
> case basis, to see where the use of these accesors may result in a
> more readable code?
>
> I am glad to carry this task in case the maintainers think is
> useful.

I'm in favor of such a change. But pls contact me in advance if you
touch Tramp files; this needs a backword compatibility layer there.

Such a change is on my todo list, but I haven't found enough time until
now.

> Regards,
> Tino

Best regards, Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-28 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28 14:53 Use file-attributes accesors in existing code Tino Calancha
2016-07-28 17:23 ` Ted Zlatanov
2016-07-28 17:35 ` Michael Albinus

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).