GNU bug report logs - #22890
25.1.50; Wishlist: There should be file-attribute accessors

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Thu, 3 Mar 2016 06:00:02 UTC

Severity: wishlist

Tags: fixed

Found in version 25.1.50

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22890 in the body.
You can then email your comments to 22890 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Thu, 03 Mar 2016 06:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 03 Mar 2016 06:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1.50; Wishlist: There should be file-attribute accessors
Date: Thu, 03 Mar 2016 05:58:54 +0000
`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.



In GNU Emacs 25.1.50.65 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.7)
 of 2016-03-03 built on mouse
Repository revision: 0c5c04d58e4efc04905a3f42e984d5f24c554a34
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	Ubuntu 15.10

Configured using:
 'configure --with-xwidgets --with-x-toolkit=gtk3'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XWIDGETS

Important settings:
  value of $LC_MONETARY: nb_NO.UTF-8
  value of $LC_NUMERIC: nb_NO.UTF-8
  value of $LC_TIME: nb_NO.UTF-8
  value of $LANG: C
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  diff-auto-refine-mode: t
  gnus-topic-mode: t
  gnus-undo-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t

Recent messages:
Sending via mail...
Sending email 
Sending email done
Mark set
Saving file /home/larsi/Mail/archive/sent/2016w09...
Wrote /home/larsi/Mail/archive/sent/2016w09
Sending...done
Making completion list... [2 times]
Type C-x 1 to delete the help window, C-M-v to scroll help.
Making completion list...

Load-path shadows:
~/src/emacs/elpa/packages/debbugs/debbugs-org hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs-org
~/src/emacs/elpa/packages/debbugs/debbugs-browse hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs-browse
~/src/emacs/elpa/packages/debbugs/debbugs-gnu hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs-gnu
~/src/emacs/elpa/packages/debbugs/debbugs hides /home/larsi/.emacs.d/elpa/debbugs-0.7/debbugs

Features:
(shadow emacsbug eieio-opt speedbar sb-image ezimage dframe find-func
timezone eww iso-transl tabify misearch multi-isearch shr-color color
mailalias smtpmail sendmail ecomplete log-edit ring pcvs-util vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-dir ewoc copyright bug-reference
whitespace vc vc-dispatcher vc-git map diff-mode gnus-html help-fns qp
url-queue url-cache mm-archive sort smiley ansi-color gnus-cite
gnus-async gnus-dup gnus-ml gmane spam-gmane dns mm-url disp-table
gnus-fun gnus-mdrtn nndraft nnmh utf-7 gnus-topic nnfolder
network-stream nsm starttls nnir spam-report spam spam-stat gnus-uu yenc
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum
gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message
format-spec rfc822 mml mml-sec epa epg mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util rmail rmail-loaddefs mail-utils
wid-edit movie mkv shr svg browse-url imdb dom pvr debug debbugs-gnu
easy-mmode derived subr-x debbugs soap-client mm-decode mm-bodies
mm-encode url-http tls gnutls url-auth mail-parse rfc2231 rfc2047
rfc2045 ietf-drums url-gw puny url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap warnings
rng-xsd rng-dt rng-util xsd-regexp xml ido seq flyspell ispell dired
dired-loaddefs add-log mail-extr mm-util mail-prsvr jka-compr cl
finder-inf info package epg-config url-handlers url-parse auth-source
cl-seq eieio byte-opt bytecomp byte-compile cl-extra help-mode easymenu
cconv eieio-core cl-macs gv eieio-loaddefs cl-loaddefs pcase cl-lib
password-cache url-vars time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 612056 52571)
 (symbols 48 163800 2)
 (miscs 40 444 1918)
 (strings 32 232021 8136)
 (string-bytes 1 8667448)
 (vectors 16 40998)
 (vector-slots 8 1738164 271804)
 (floats 8 771 2486)
 (intervals 56 6959 1064)
 (buffers 976 58)
 (heap 1024 205225 83336))

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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Fri, 04 Mar 2016 15:35:03 GMT) Full text and rfc822 format available.

Message #8 received at 22890 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 22890 <at> debbugs.gnu.org
Subject: Re: bug#22890: 25.1.50;
 Wishlist: There should be file-attribute accessors
Date: Fri, 04 Mar 2016 13:39:23 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> 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.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Mar 2016 15:35:06 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 22890 <at> debbugs.gnu.org and Lars Ingebrigtsen <larsi <at> gnus.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Mar 2016 15:35:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Fri, 04 Mar 2016 16:19:02 GMT) Full text and rfc822 format available.

Message #15 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#22890: 25.1.50;
 Wishlist: There should be file-attribute accessors
Date: Fri, 04 Mar 2016 16:17:54 +0000
On Fri 04 Mar 2016, Lars Ingebrigtsen wrote:

> Lars Ingebrigtsen <larsi <at> gnus.org> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Fri, 04 Mar 2016 19:27:02 GMT) Full text and rfc822 format available.

Message #18 received at 22890 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Andy Moreton <andrewjmoreton <at> gmail.com>
Cc: 22890 <at> debbugs.gnu.org
Subject: Re: bug#22890: 25.1.50;
 Wishlist: There should be file-attribute accessors
Date: Fri, 04 Mar 2016 20:25:52 +0100
Andy Moreton <andrewjmoreton <at> gmail.com> writes:

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

Is there a way to get the byte compiler to output warnings about using
`nth' on output from `file-attributes'?  That would be awesome.  But I
would guess not.  But grepping for "nth.*file-attributes" gives us 180
matches, so somebody who wants to start fixing could...  start...  :-)

Anyway, we probably shouldn't do anything wholesale until 25.1 has been
released (to make merging easier).

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Fri, 04 Mar 2016 19:52:01 GMT) Full text and rfc822 format available.

Message #21 received at 22890 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>, Andy Moreton
 <andrewjmoreton <at> gmail.com>
Cc: 22890 <at> debbugs.gnu.org
Subject: RE: bug#22890: 25.1.50; Wishlist: There should be file-attribute
 accessors
Date: Fri, 4 Mar 2016 11:51:41 -0800 (PST)
> Is there a way to get the byte compiler to output warnings about
> using `nth' on output from `file-attributes'?  That would be awesome.  

It would not be awesome.  It would be annoying.
There is nothing to WARN about here.

If you want to control usage for internal Emacs Dev
code then do just that.  But for Emacs-Lisp users
in general this would be completely inappropriate.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Fri, 04 Mar 2016 20:01:02 GMT) Full text and rfc822 format available.

Message #24 received at 22890 <at> debbugs.gnu.org (full text, mbox):

From: John Wiegley <jwiegley <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 22890 <at> debbugs.gnu.org, Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
 Andy Moreton <andrewjmoreton <at> gmail.com>
Subject: Re: bug#22890: 25.1.50;
 Wishlist: There should be file-attribute accessors
Date: Fri, 04 Mar 2016 12:00:22 -0800
>>>>> Drew Adams <drew.adams <at> oracle.com> writes:

>> Is there a way to get the byte compiler to output warnings about using
>> `nth' on output from `file-attributes'? That would be awesome.

> It would not be awesome. It would be annoying. There is nothing to WARN
> about here.

You could add something of that effect to elint, for example.  I'm not sure if
elint supports "level", or disabling certain warnings, but if it's bad style,
it would be nice to have an indication of it in a non-intrusive way.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22890; Package emacs. (Fri, 04 Mar 2016 20:21:02 GMT) Full text and rfc822 format available.

Message #27 received at 22890 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: John Wiegley <johnw <at> gnu.org>
Cc: 22890 <at> debbugs.gnu.org, Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
 Andy Moreton <andrewjmoreton <at> gmail.com>
Subject: RE: bug#22890: 25.1.50; Wishlist: There should be file-attribute
 accessors
Date: Fri, 4 Mar 2016 12:20:27 -0800 (PST)
> >> Is there a way to get the byte compiler to output warnings about
> >> using `nth' on output from `file-attributes'? That would be awesome.
> 
> > It would not be awesome. It would be annoying. There is nothing to
> > WARN about here.
> 
> You could add something of that effect to elint, for example.  I'm
> not sure if elint supports "level", or disabling certain warnings,
> but if it's bad style, it would be nice to have an indication of it
> in a non-intrusive way.

Yes.  Provide it as an (opt-in) option or a command or some other
way for users to get such information on demand.  It's good to be
able to _ask_ for lint-like checks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Apr 2016 11:24:06 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Jan 2017 12:24:26 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.