aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert2018-09-23 18:30:46 -0700
committerPaul Eggert2018-09-23 18:32:59 -0700
commit662bee7d70ccd3903e123b08c7ec9108a1a2ce0b (patch)
tree416de288b7f995a05f620c5a6e72cb5a30168551 /doc
parentc2dee17e19e1cf80c2263f8de276cceb0252b76d (diff)
downloademacs-662bee7d70ccd3903e123b08c7ec9108a1a2ce0b.tar.gz
emacs-662bee7d70ccd3903e123b08c7ec9108a1a2ce0b.zip
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with more-informative calls like (file-attribute-access-time A). It also fixes some documentation and minor timestamp coding issues that I noticed while looking into this. * doc/lispref/files.texi (File Attributes): * lisp/files.el (file-attribute-size) (file-attribute-inode-number, file-attribute-device-number): * src/dired.c (Fdirectory_files_and_attributes) (Ffile_attributes): Mention which attributes must be integers, or nonnegative integers, as opposed to merely being numbers. Remove no-longer-correct talk about representing large integers as conses of integers. * doc/lispref/files.texi (Magic File Names): * doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary): * lisp/autorevert.el (auto-revert-find-file-function) (auto-revert-tail-mode, auto-revert-handler): * lisp/auth-source.el (auth-source-netrc-parse): * lisp/cedet/ede/files.el (ede--inode-for-dir): * lisp/cedet/semantic/db-file.el (object-write): * lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook): * lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p) (semanticdb-synchronize): * lisp/cedet/srecode/table.el (srecode-mode-table-new): * lisp/desktop.el (desktop-save, desktop-read): * lisp/dired-aux.el (dired-file-set-difference) (dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive) (dired-create-files): * lisp/dired.el (dired-directory-changed-p, dired-readin): * lisp/dos-w32.el (w32-direct-print-region-helper): * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads) (autoload-find-destination, update-directory-autoloads): * lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent): * lisp/epg.el (epg--start, epg-wait-for-completion): * lisp/eshell/em-ls.el (eshell-ls-filetype-p) (eshell-ls-applicable, eshell-ls-size-string) (eshell-ls-file, eshell-ls-dir, eshell-ls-files) (eshell-ls-entries): * lisp/eshell/em-pred.el (eshell-predicate-alist) (eshell-pred-file-type, eshell-pred-file-links) (eshell-pred-file-size): * lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat) (eshell-du-sum-directory, eshell/du): * lisp/eshell/esh-util.el (eshell-read-passwd) (eshell-read-hosts): * lisp/files.el (remote-file-name-inhibit-cache) (find-file-noselect, insert-file-1, dir-locals-find-file) (dir-locals-read-from-dir, backup-buffer) (file-ownership-preserved-p, copy-directory) (read-file-modes): * lisp/find-lisp.el (find-lisp-format): * lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles) (gnus-agent-read-agentview, gnus-agent-expire-group-1) (gnus-agent-request-article, gnus-agent-regenerate-group) (gnus-agent-update-files-total-fetched-for) (gnus-agent-update-view-total-fetched-for): * lisp/gnus/gnus-cache.el (gnus-cache-read-active) (gnus-cache-update-file-total-fetched-for) (gnus-cache-update-overview-total-fetched-for): * lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p): * lisp/gnus/gnus-score.el (gnus-score-score-files): * lisp/gnus/gnus-start.el (gnus-save-newsrc-file) (gnus-master-read-slave-newsrc): * lisp/gnus/gnus-sum.el (gnus-summary-import-article): * lisp/gnus/gnus-util.el (gnus-file-newer-than) (gnus-cache-file-contents): * lisp/gnus/mail-source.el (mail-source-delete-old-incoming) (mail-source-callback, mail-source-movemail): * lisp/gnus/nneething.el (nneething-create-mapping) (nneething-make-head): * lisp/gnus/nnfolder.el (nnfolder-read-folder): * lisp/gnus/nnheader.el (nnheader-file-size) (nnheader-insert-nov-file): * lisp/gnus/nnmail.el (nnmail-activate): * lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum) (nnmaildir--new-number, nnmaildir--update-nov) (nnmaildir--scan, nnmaildir-request-scan) (nnmaildir-request-update-info) (nnmaildir-request-expire-articles): * lisp/gnus/nnmh.el (nnmh-request-list-1) (nnmh-request-expire-articles, nnmh-update-gnus-unreads): * lisp/gnus/nnml.el (nnml-request-expire-articles): * lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load) (spam-stat-process-directory, spam-stat-test-directory): * lisp/ido.el (ido-directory-too-big-p) (ido-file-name-all-completions): * lisp/image-dired.el (image-dired-get-thumbnail-image) (image-dired-create-thumb-1): * lisp/info.el (info-insert-file-contents): * lisp/ls-lisp.el (ls-lisp-insert-directory) (ls-lisp-handle-switches, ls-lisp-classify-file) (ls-lisp-format): * lisp/mail/blessmail.el: * lisp/mail/feedmail.el (feedmail-default-date-generator) (feedmail-default-message-id-generator): * lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases) (mail-abbrevs-setup): * lisp/mail/mspools.el (mspools-size-folder): * lisp/mail/rmail.el (rmail-insert-inbox-text): * lisp/mail/sendmail.el (sendmail-sync-aliases): * lisp/mh-e/mh-alias.el (mh-alias-tstamp): * lisp/net/ange-ftp.el (ange-ftp-parse-netrc) (ange-ftp-write-region, ange-ftp-file-newer-than-file-p) (ange-ftp-cf1): * lisp/net/eudcb-mab.el (eudc-mab-query-internal): * lisp/net/eww.el (eww-read-bookmarks): * lisp/net/netrc.el (netrc-parse): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file): * lisp/obsolete/fast-lock.el (fast-lock-save-cache): * lisp/obsolete/vc-arch.el (vc-arch-state) (vc-arch-diff3-rej-p): * lisp/org/ob-eval.el (org-babel--shell-command-on-region): * lisp/org/org-attach.el (org-attach-commit): * lisp/org/org-macro.el (org-macro-initialize-templates): * lisp/org/org.el (org-babel-load-file) (org-file-newer-than-p): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-publish.el (org-publish-find-date) (org-publish-cache-ctime-of-src): * lisp/pcmpl-gnu.el (pcomplete/tar): * lisp/pcmpl-rpm.el (pcmpl-rpm-packages): * lisp/play/cookie1.el (cookie-snarf): * lisp/progmodes/cmacexp.el (c-macro-expansion): * lisp/ps-bdf.el (bdf-file-mod-time): * lisp/server.el (server-ensure-safe-dir): * lisp/simple.el (shell-command-on-region): * lisp/speedbar.el (speedbar-item-info-file-helper) (speedbar-check-obj-this-line): * lisp/thumbs.el (thumbs-cleanup-thumbsdir): * lisp/time.el (display-time-mail-check-directory) (display-time-file-nonempty-p): * lisp/url/url-cache.el (url-is-cached): * lisp/url/url-file.el (url-file-asynch-callback): * lisp/vc/diff-mode.el (diff-delete-if-empty): * lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries): * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): * lisp/vc/vc-cvs.el (vc-cvs-checkout-model) (vc-cvs-state-heuristic, vc-cvs-merge-news) (vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry): * lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1) (vc-hg--ignore-patterns-valid-p) (vc-hg--cached-dirstate-search, vc-hg-state-fast): * lisp/vc/vc-hooks.el (vc-after-save): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): * lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status): * lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file): * lisp/xdg.el (xdg-mime-apps): Prefer (file-attribute-size A) to (nth 7 A), and similarly for other file attributes accessors. * doc/lispref/files.texi (File Attributes): * doc/lispref/intro.texi (Version Info): * doc/lispref/os.texi (Idle Timers): * lisp/erc/erc.el (erc-string-to-emacs-time): * lisp/files.el (file-attribute-access-time) (file-attribute-modification-time) (file-attribute-status-change-time): * lisp/net/tramp-compat.el: (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-size): * src/buffer.c (syms_of_buffer): * src/editfns.c (Fget_internal_run_time): * src/fileio.c (Fvisited_file_modtime) (Fset_visited_file_modtime): * src/keyboard.c (Fcurrent_idle_time): * src/process.c (Fprocess_attributes): Defer implementation details about timestamp format to the section that talks about timestamp format, to make it easier to change the documentation later if timestamp formats are extended. * lisp/gnus/gnus-util.el (gnus-file-newer-than): * lisp/speedbar.el (speedbar-check-obj-this-line): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): Prefer time-less-p to doing it by hand. * lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses. * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): Use eql, not eq, to compare integers that might be bignums. * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): Prefer float-time to doing time arithmetic by hand.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/files.texi25
-rw-r--r--doc/lispref/intro.texi2
-rw-r--r--doc/lispref/os.texi3
-rw-r--r--doc/misc/gnus.texi4
4 files changed, 17 insertions, 17 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index c50e358beb5..5682919b645 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1299,28 +1299,27 @@ Alternate names, also known as hard links, can be created by using the
1299@item 1299@item
1300The file's @acronym{UID}, normally as a string 1300The file's @acronym{UID}, normally as a string
1301(@code{file-attribute-user-id}). However, if it does not correspond 1301(@code{file-attribute-user-id}). However, if it does not correspond
1302to a named user, the value is a number. 1302to a named user, the value is an integer.
1303 1303
1304@item 1304@item
1305The file's @acronym{GID}, likewise (@code{file-attribute-group-id}). 1305The file's @acronym{GID}, likewise (@code{file-attribute-group-id}).
1306 1306
1307@item 1307@item
1308The time of last access, as a list of four integers 1308The time of last access as a Lisp timestamp
1309@code{(@var{sec-high} @var{sec-low} @var{microsec} @var{picosec})} 1309(@code{file-attribute-status-change-time}). The timestamp is in the
1310(@code{file-attribute-access-time}). (This is similar to the value of 1310style of @code{current-time} (@pxref{Time of Day}) and is truncated
1311@code{current-time}; see @ref{Time of Day}.) The value is truncated
1312to that of the filesystem's timestamp resolution; for example, on some 1311to that of the filesystem's timestamp resolution; for example, on some
1313FAT-based filesystems, only the date of last access is recorded, so 1312FAT-based filesystems, only the date of last access is recorded, so
1314this time will always hold the midnight of the day of the last access. 1313this time will always hold the midnight of the day of the last access.
1315 1314
1316@cindex modification time of file 1315@cindex modification time of file
1317@item 1316@item
1318The time of last modification as a list of four integers (as above) 1317The time of last modification as a Lisp timestamp
1319(@code{file-attribute-modification-time}). This is the last time when 1318(@code{file-attribute-modification-time}). This is the last time when
1320the file's contents were modified. 1319the file's contents were modified.
1321 1320
1322@item 1321@item
1323The time of last status change as a list of four integers (as above) 1322The time of last status change as a Lisp timestamp
1324(@code{file-attribute-status-change-time}). This is the time of the 1323(@code{file-attribute-status-change-time}). This is the time of the
1325last change to the file's access mode bits, its owner and group, and 1324last change to the file's access mode bits, its owner and group, and
1326other information recorded in the filesystem for the file, beyond the 1325other information recorded in the filesystem for the file, beyond the
@@ -1337,11 +1336,12 @@ The file's modes, as a string of ten letters or dashes, as in
1337An unspecified value, present for backward compatibility. 1336An unspecified value, present for backward compatibility.
1338 1337
1339@item 1338@item
1340The file's inode number (@code{file-attribute-inode-number}). 1339The file's inode number (@code{file-attribute-inode-number}),
1340a nonnegative integer.
1341 1341
1342@item 1342@item
1343The filesystem number of the device that the file is on 1343The filesystem number of the device that the file is on
1344@code{file-attribute-device-number}). 1344@code{file-attribute-device-number}), an integer.
1345This element and the file's inode number 1345This element and the file's inode number
1346together give enough information to distinguish any two files on the 1346together give enough information to distinguish any two files on the
1347system---no two files can have the same values for both of these 1347system---no two files can have the same values for both of these
@@ -2918,7 +2918,7 @@ are included.
2918This is similar to @code{directory-files} in deciding which files 2918This is similar to @code{directory-files} in deciding which files
2919to report on and how to report their names. However, instead 2919to report on and how to report their names. However, instead
2920of returning a list of file names, it returns for each file a 2920of returning a list of file names, it returns for each file a
2921list @code{(@var{filename} @var{attributes})}, where @var{attributes} 2921list @code{(@var{filename} . @var{attributes})}, where @var{attributes}
2922is what @code{file-attributes} returns for that file. 2922is what @code{file-attributes} returns for that file.
2923The optional argument @var{id-format} has the same meaning as the 2923The optional argument @var{id-format} has the same meaning as the
2924corresponding argument to @code{file-attributes} (@pxref{Definition 2924corresponding argument to @code{file-attributes} (@pxref{Definition
@@ -3410,8 +3410,9 @@ between consecutive checks. For example:
3410 (let ((remote-file-name-inhibit-cache 3410 (let ((remote-file-name-inhibit-cache
3411 (- display-time-interval 5))) 3411 (- display-time-interval 5)))
3412 (and (file-exists-p file) 3412 (and (file-exists-p file)
3413 (< 0 (nth 7 (file-attributes 3413 (< 0 (file-attribute-size
3414 (file-chase-links file))))))) 3414 (file-attributes
3415 (file-chase-links file)))))))
3415@end example 3416@end example
3416@end defopt 3417@end defopt
3417 3418
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index f421f3b3efb..197f54ecc52 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -493,7 +493,7 @@ giving a prefix argument makes @var{here} non-@code{nil}.
493 493
494@defvar emacs-build-time 494@defvar emacs-build-time
495The value of this variable indicates the time at which Emacs was 495The value of this variable indicates the time at which Emacs was
496built. It is a list of four integers, like the value of 496built. It uses the style of
497@code{current-time} (@pxref{Time of Day}), or is @code{nil} 497@code{current-time} (@pxref{Time of Day}), or is @code{nil}
498if the information is not available. 498if the information is not available.
499 499
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 43ca9ede00b..8481fea8062 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1991,8 +1991,7 @@ the idleness time, as described below.
1991 1991
1992@defun current-idle-time 1992@defun current-idle-time
1993If Emacs is idle, this function returns the length of time Emacs has 1993If Emacs is idle, this function returns the length of time Emacs has
1994been idle, as a list of four integers: @code{(@var{sec-high} 1994been idle, using the same format as
1995@var{sec-low} @var{microsec} @var{picosec})}, using the same format as
1996@code{current-time} (@pxref{Time of Day}). 1995@code{current-time} (@pxref{Time of Day}).
1997 1996
1998When Emacs is not idle, @code{current-idle-time} returns @code{nil}. 1997When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 6ccb9e55f31..40cc44a12e7 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -25889,13 +25889,13 @@ Reset: (setq spam-stat (make-hash-table :test 'equal))
25889Learn spam: (spam-stat-process-spam-directory "~/Mail/mail/spam") 25889Learn spam: (spam-stat-process-spam-directory "~/Mail/mail/spam")
25890Learn non-spam: (spam-stat-process-non-spam-directory "~/Mail/mail/misc") 25890Learn non-spam: (spam-stat-process-non-spam-directory "~/Mail/mail/misc")
25891Save table: (spam-stat-save) 25891Save table: (spam-stat-save)
25892File size: (nth 7 (file-attributes spam-stat-file)) 25892File size: (file-attribute-size (file-attributes spam-stat-file))
25893Number of words: (hash-table-count spam-stat) 25893Number of words: (hash-table-count spam-stat)
25894Test spam: (spam-stat-test-directory "~/Mail/mail/spam") 25894Test spam: (spam-stat-test-directory "~/Mail/mail/spam")
25895Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc") 25895Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc")
25896Reduce table size: (spam-stat-reduce-size) 25896Reduce table size: (spam-stat-reduce-size)
25897Save table: (spam-stat-save) 25897Save table: (spam-stat-save)
25898File size: (nth 7 (file-attributes spam-stat-file)) 25898File size: (file-attribute-size (file-attributes spam-stat-file))
25899Number of words: (hash-table-count spam-stat) 25899Number of words: (hash-table-count spam-stat)
25900Test spam: (spam-stat-test-directory "~/Mail/mail/spam") 25900Test spam: (spam-stat-test-directory "~/Mail/mail/spam")
25901Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc") 25901Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc")