@item
The file's @acronym{UID}, normally as a string
(@code{file-attribute-user-id}). However, if it does not correspond
-to a named user, the value is a number.
+to a named user, the value is an integer.
@item
The file's @acronym{GID}, likewise (@code{file-attribute-group-id}).
@item
-The time of last access, as a list of four integers
-@code{(@var{sec-high} @var{sec-low} @var{microsec} @var{picosec})}
-(@code{file-attribute-access-time}). (This is similar to the value of
-@code{current-time}; see @ref{Time of Day}.) The value is truncated
+The time of last access as a Lisp timestamp
+(@code{file-attribute-status-change-time}). The timestamp is in the
+style of @code{current-time} (@pxref{Time of Day}) and is truncated
to that of the filesystem's timestamp resolution; for example, on some
FAT-based filesystems, only the date of last access is recorded, so
this time will always hold the midnight of the day of the last access.
@cindex modification time of file
@item
-The time of last modification as a list of four integers (as above)
+The time of last modification as a Lisp timestamp
(@code{file-attribute-modification-time}). This is the last time when
the file's contents were modified.
@item
-The time of last status change as a list of four integers (as above)
+The time of last status change as a Lisp timestamp
(@code{file-attribute-status-change-time}). This is the time of the
last change to the file's access mode bits, its owner and group, and
other information recorded in the filesystem for the file, beyond the
An unspecified value, present for backward compatibility.
@item
-The file's inode number (@code{file-attribute-inode-number}).
+The file's inode number (@code{file-attribute-inode-number}),
+a nonnegative integer.
@item
The filesystem number of the device that the file is on
-@code{file-attribute-device-number}).
+@code{file-attribute-device-number}), an integer.
This element and the file's inode number
together give enough information to distinguish any two files on the
system---no two files can have the same values for both of these
This is similar to @code{directory-files} in deciding which files
to report on and how to report their names. However, instead
of returning a list of file names, it returns for each file a
-list @code{(@var{filename} @var{attributes})}, where @var{attributes}
+list @code{(@var{filename} . @var{attributes})}, where @var{attributes}
is what @code{file-attributes} returns for that file.
The optional argument @var{id-format} has the same meaning as the
corresponding argument to @code{file-attributes} (@pxref{Definition
(let ((remote-file-name-inhibit-cache
(- display-time-interval 5)))
(and (file-exists-p file)
- (< 0 (nth 7 (file-attributes
- (file-chase-links file)))))))
+ (< 0 (file-attribute-size
+ (file-attributes
+ (file-chase-links file)))))))
@end example
@end defopt
@defvar emacs-build-time
The value of this variable indicates the time at which Emacs was
-built. It is a list of four integers, like the value of
+built. It uses the style of
@code{current-time} (@pxref{Time of Day}), or is @code{nil}
if the information is not available.
@defun current-idle-time
If Emacs is idle, this function returns the length of time Emacs has
-been idle, as a list of four integers: @code{(@var{sec-high}
-@var{sec-low} @var{microsec} @var{picosec})}, using the same format as
+been idle, using the same format as
@code{current-time} (@pxref{Time of Day}).
When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
Learn spam: (spam-stat-process-spam-directory "~/Mail/mail/spam")
Learn non-spam: (spam-stat-process-non-spam-directory "~/Mail/mail/misc")
Save table: (spam-stat-save)
-File size: (nth 7 (file-attributes spam-stat-file))
+File size: (file-attribute-size (file-attributes spam-stat-file))
Number of words: (hash-table-count spam-stat)
Test spam: (spam-stat-test-directory "~/Mail/mail/spam")
Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc")
Reduce table size: (spam-stat-reduce-size)
Save table: (spam-stat-save)
-File size: (nth 7 (file-attributes spam-stat-file))
+File size: (file-attribute-size (file-attributes spam-stat-file))
Number of words: (hash-table-count spam-stat)
Test spam: (spam-stat-test-directory "~/Mail/mail/spam")
Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc")
(if (and (functionp cached-secrets)
(equal cached-mtime
- (nth 5 (file-attributes file))))
+ (file-attribute-modification-time
+ (file-attributes file))))
(progn
(auth-source-do-trivia
"auth-source-netrc-parse: using CACHED file data for %s"
;; (note for the irony-impaired: they are just obfuscated)
(auth-source--aput
auth-source-netrc-cache file
- (list :mtime (nth 5 (file-attributes file))
+ (list :mtime (file-attribute-modification-time
+ (file-attributes file))
:secret (let ((v (mapcar #'1+ (buffer-string))))
(lambda () (apply #'string (mapcar #'1- v)))))))
(goto-char (point-min))
(defun auto-revert-find-file-function ()
(setq-local auto-revert-tail-pos
- (nth 7 (file-attributes buffer-file-name))))
+ (file-attribute-size (file-attributes buffer-file-name))))
(add-hook 'find-file-hook
#'auto-revert-find-file-function)
(add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t)
(or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position
(setq-local auto-revert-tail-pos
- (nth 7 (file-attributes buffer-file-name))))
+ (file-attribute-size
+ (file-attributes buffer-file-name))))
;; let auto-revert-mode set up the mechanism for us if it isn't already
(or auto-revert-mode
(let ((auto-revert-tail-mode t))
(and (file-readable-p buffer-file-name)
(/= auto-revert-tail-pos
(setq size
- (nth 7 (file-attributes
- buffer-file-name)))))
+ (file-attribute-size
+ (file-attributes buffer-file-name)))))
(funcall (or buffer-stale-function
#'buffer-stale--default-function)
t)))
(if ede--disable-inode
(ede--put-inode-dir-hash dir 0)
(let ((fattr (file-attributes dir)))
- (ede--put-inode-dir-hash dir (nth 10 fattr))
+ (ede--put-inode-dir-hash dir (file-attribute-inode-number fattr))
)))))
(cl-defmethod ede--project-inode ((proj ede-project-placeholder))
;; Make sure that the file size and other attributes are
;; up to date.
(let ((fattr (file-attributes (semanticdb-full-filename obj))))
- (oset obj fsize (nth 7 fattr))
- (oset obj lastmodtime (nth 5 fattr))
+ (oset obj fsize (file-attribute-size fattr))
+ (oset obj lastmodtime (file-attribute-modification-time fattr))
)
;; Do it!
(let ((fattr (file-attributes
(semanticdb-full-filename
semanticdb-current-table))))
- (oset semanticdb-current-table fsize (nth 7 fattr))
- (oset semanticdb-current-table lastmodtime (nth 5 fattr))
+ (oset semanticdb-current-table fsize (file-attribute-size fattr))
+ (oset semanticdb-current-table lastmodtime
+ (file-attribute-modification-time fattr))
(oset semanticdb-current-table buffer nil)
))
;; If this messes up, just clear the system
;; Buffer isn't loaded. The only clue we have is if the file
;; is somehow different from our mark in the semanticdb table.
(let* ((stats (file-attributes ff))
- (actualsize (nth 7 stats))
- (actualmod (nth 5 stats))
+ (actualsize (file-attribute-size stats))
+ (actualmod (file-attribute-modification-time stats))
)
(or (not (slot-boundp obj 'tags))
(oset table tags new-tags)
(oset table pointmax (point-max))
(let ((fattr (file-attributes (semanticdb-full-filename table))))
- (oset table fsize (nth 7 fattr))
- (oset table lastmodtime (nth 5 fattr))
+ (oset table fsize (file-attribute-size fattr))
+ (oset table lastmodtime (file-attribute-modification-time fattr))
)
;; Assume it is now up to date.
(oset table unmatched-syntax semantic-unmatched-syntax-cache)
(new (apply 'srecode-template-table
(file-name-nondirectory file)
:file file
- :filesize (nth 7 attr)
- :filedate (nth 5 attr)
+ :filesize (file-attribute-size attr)
+ :filedate (file-attribute-modification-time attr)
:major-mode mode
init
)))
(setq desktop-dirname (file-name-as-directory (expand-file-name dirname)))
(save-excursion
(let ((eager desktop-restore-eager)
- (new-modtime (nth 5 (file-attributes (desktop-full-file-name)))))
+ (new-modtime (file-attribute-modification-time
+ (file-attributes (desktop-full-file-name)))))
(when
(or (not new-modtime) ; nothing to overwrite
(equal desktop-file-modtime new-modtime)
(write-region (point-min) (point-max) (desktop-full-file-name) nil 'nomessage))
(setq desktop-file-checksum checksum)
;; We remember when it was modified (which is presumably just now).
- (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))))))))))
+ (setq desktop-file-modtime (file-attribute-modification-time
+ (file-attributes
+ (desktop-full-file-name)))))))))))
;; ----------------------------------------------------------------------------
;;;###autoload
'window-configuration-change-hook)))
(desktop-auto-save-disable)
;; Evaluate desktop buffer and remember when it was modified.
- (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name))))
+ (setq desktop-file-modtime (file-attribute-modification-time
+ (file-attributes
+ (desktop-full-file-name))))
(load (desktop-full-file-name) t t t)
;; If it wasn't already, mark it as in-use, to bother other
;; desktop instances.
(> mtime1 mtime2) - mark newer files
(not (= size1 size2)) - mark files with different sizes
- (not (string= (nth 8 fa1) (nth 8 fa2))) - mark files with different modes
- (not (and (= (nth 2 fa1) (nth 2 fa2)) - mark files with different UID
- (= (nth 3 fa1) (nth 3 fa2)))) and GID."
+ (not (string= (file-attribute-modes fa1) - mark files with different modes
+ (file-attribute-modes fa2)))
+ (not (and (= (file-attribute-user-id fa1) - mark files with different UID
+ (file-attribute-user-id fa2))
+ (= (file-attribute-group-id fa1) - and GID.
+ (file-attribute-group-id fa2))))"
(interactive
(list
(let* ((target-dir (dired-dwim-target-directory))
(eval predicate
`((fa1 . ,fa1)
(fa2 . ,fa2)
- (size1 . ,(nth 7 fa1))
- (size2 . ,(nth 7 fa2))
+ (size1 . ,(file-attribute-size fa1))
+ (size2 . ,(file-attribute-size fa2))
(mtime1
- . ,(float-time (nth 5 fa1)))
+ . ,(float-time (file-attribute-modification-time fa1)))
(mtime2
- . ,(float-time (nth 5 fa2)))
+ . ,(float-time (file-attribute-modification-time fa2)))
)))))
(setq list (cdr list)))
list)
(cond ((eq op-symbol 'touch)
(format-time-string
"%Y%m%d%H%M.%S"
- (nth 5 (file-attributes default-file))))
+ (file-attribute-modification-time
+ (file-attributes default-file))))
((eq op-symbol 'chown)
- (nth 2 (file-attributes default-file 'string)))
+ (file-attribute-user-id
+ (file-attributes default-file 'string)))
((eq op-symbol 'chgrp)
- (nth 3 (file-attributes default-file 'string))))))
+ (file-attribute-group-id
+ (file-attributes default-file 'string))))))
(prompt (concat "Change " attribute-name " of %s to"
(if (eq op-symbol 'touch)
" (default now): "
;; The source of default file attributes is the file at point.
(default-file (dired-get-filename t t))
(modestr (when default-file
- (nth 8 (file-attributes default-file))))
+ (file-attribute-modes (file-attributes default-file))))
(default
(and (stringp modestr)
(string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr)
(defun dired-copy-file-recursive (from to ok-flag &optional
preserve-time top recursive)
- (when (and (eq t (car (file-attributes from)))
+ (when (and (eq t (file-attribute-type (file-attributes from)))
(file-in-directory-p to from))
(error "Cannot copy `%s' into its subdirectory `%s'" from to))
(let ((attrs (file-attributes from)))
(if (and recursive
- (eq t (car attrs))
+ (eq t (file-attribute-type attrs))
(or (eq recursive 'always)
(yes-or-no-p (format "Recursive copies of %s? " from))))
(copy-directory from to preserve-time)
(or top (dired-handle-overwrite to))
(condition-case err
- (if (stringp (car attrs))
+ (if (stringp (file-attribute-type attrs))
;; It is a symlink
- (make-symbolic-link (car attrs) to ok-flag)
+ (make-symbolic-link (file-attribute-type attrs) to ok-flag)
(dired-maybe-create-dirs (file-name-directory to))
(copy-file from to ok-flag preserve-time))
(file-date-error
(setq to destname))
;; If DESTNAME is a subdirectory of FROM, not a symlink,
;; and the method in use is copying, signal an error.
- (and (eq t (car (file-attributes destname)))
+ (and (eq t (file-attribute-type (file-attributes destname)))
(eq file-creator 'dired-copy-file)
(file-in-directory-p destname from)
(error "Cannot copy `%s' into its subdirectory `%s'"
(not (let ((attributes (file-attributes dirname))
(modtime (visited-file-modtime)))
(or (eq modtime 0)
- (not (eq (car attributes) t))
- (equal (nth 5 attributes) modtime)))))
+ (not (eq (file-attribute-type attributes) t))
+ (equal (file-attribute-modification-time attributes) modtime)))))
(defvar auto-revert-remote-files)
(dired-build-subdir-alist)
(let ((attributes (file-attributes dirname)))
(if (eq (car attributes) t)
- (set-visited-file-modtime (nth 5 attributes))))
+ (set-visited-file-modtime (file-attribute-modification-time
+ attributes))))
(set-buffer-modified-p nil)
;; No need to narrow since the whole buffer contains just
;; dired-readin's output, nothing else. The hook can
w32-direct-print-region-use-command-dot-com
;; file-attributes fails on LPT ports on Windows 9x but
;; not on NT, so handle both cases for safety.
- (eq (or (nth 7 (file-attributes printer)) 0) 0))
+ (eq (or (file-attribute-size (file-attributes printer)) 0) 0))
(write-region start end tempfile nil 0)
(let ((w32-quote-process-args nil))
(call-process "command.com" nil errbuf nil "/c"
(marker-buffer other-output-start)
"actual autoloads are elsewhere" load-name relfile
(if autoload-timestamps
- (nth 5 (file-attributes absfile))
+ (file-attribute-modification-time
+ (file-attributes absfile))
autoload--non-timestamp))
(insert ";;; Generated autoloads from " relfile "\n")))
(insert generate-autoload-section-trailer)))))))
;; `emacs-internal' instead.
nil nil 'emacs-mule-unix)
(if autoload-timestamps
- (nth 5 (file-attributes relfile))
+ (file-attribute-modification-time
+ (file-attributes relfile))
autoload--non-timestamp)))
(insert ";;; Generated autoloads from " relfile "\n")))
(insert generate-autoload-section-trailer))))
;; If the entries were added to some other buffer, then the file
;; doesn't add entries to OUTFILE.
otherbuf))
- (nth 5 (file-attributes absfile))))
+ (file-attribute-modification-time (file-attributes absfile))))
(error
;; Probably unbalanced parens in forward-sexp. In that case, the
;; condition is scan-error, and the signal data includes point
(existing-buffer (if buffer-file-name buf))
(output-file (autoload-generated-file))
(output-time (if (file-exists-p output-file)
- (nth 5 (file-attributes output-file))))
+ (file-attribute-modification-time
+ (file-attributes output-file))))
(found nil))
(with-current-buffer (autoload-find-generated-file)
;; This is to make generated-autoload-file have Unix EOLs, so
;; Check if it is up to date.
(let ((begin (match-beginning 0))
(last-time (nth 4 form))
- (file-time (nth 5 (file-attributes file))))
+ (file-time (file-attribute-modification-time
+ (file-attributes file))))
(if (and (or (null existing-buffer)
(not (buffer-modified-p existing-buffer)))
(cond
generated-autoload-file))
(output-time
(if (file-exists-p generated-autoload-file)
- (nth 5 (file-attributes generated-autoload-file)))))
+ (file-attribute-modification-time
+ (file-attributes generated-autoload-file)))))
(with-current-buffer (autoload-find-generated-file)
(save-excursion
(if (member last-time (list t autoload--non-timestamp))
(setq last-time output-time))
(dolist (file file)
- (let ((file-time (nth 5 (file-attributes file))))
+ (let ((file-time (file-attribute-modification-time
+ (file-attributes file))))
(when (and file-time
(not (time-less-p last-time file-time)))
;; file unchanged
t autoload--non-timestamp))
output-time
oldtime))
- (nth 5 (file-attributes file))))
+ (file-attribute-modification-time
+ (file-attributes file))))
;; File hasn't changed.
nil)
(t
(or (equal (file-truename f1) (file-truename f2))
;; As a quick test, avoiding spawning a process, compare file
;; sizes.
- (and (= (nth 7 (file-attributes f1))
- (nth 7 (file-attributes f2)))
+ (and (= (file-attribute-size (file-attributes f1))
+ (file-attribute-size (file-attributes f2)))
(eq 0 (call-process "cmp" nil nil nil "-s" f1 f2))))))))
(defvar load-path-shadows-font-lock-keywords
;; for more details.
(when (and agent-info (string-match "\\(.*\\):[0-9]+:[0-9]+" agent-info))
(setq agent-file (match-string 1 agent-info)
- agent-mtime (or (nth 5 (file-attributes agent-file)) '(0 0 0 0))))
+ agent-mtime (or (file-attribute-modification-time
+ (file-attributes agent-file))
+ '(0 0 0 0))))
(if epg-debug
(save-excursion
(unless epg-debug-buffer
(if (with-current-buffer (process-buffer (epg-context-process context))
(and epg-agent-file
(time-less-p epg-agent-mtime
- (or (nth 5 (file-attributes epg-agent-file)) 0))))
+ (or (file-attribute-modification-time
+ (file-attributes epg-agent-file))
+ 0))))
(redraw-frame))
(epg-context-set-result-for
context 'error
;; time routines
(defun erc-string-to-emacs-time (string)
- "Convert the long number represented by STRING into an Emacs format.
-Returns a list of the form (HIGH LOW), compatible with Emacs time format."
+ "Convert the long number represented by STRING into an Emacs timestamp."
(let* ((n (string-to-number (concat string ".0"))))
(list (truncate (/ n 65536))
(truncate (mod n 65536)))))
"The face used for highlighting junk file names.")
(defsubst eshell-ls-filetype-p (attrs type)
- "Test whether ATTRS specifies a directory."
- (if (nth 8 attrs)
- (eq (aref (nth 8 attrs) 0) type)))
+ "Test whether ATTRS specifies a file of type TYPE."
+ (if (file-attribute-modes attrs)
+ (eq (aref (file-attribute-modes attrs) 0) type)))
(defmacro eshell-ls-applicable (attrs index func file)
"Test whether, for ATTRS, the user can do what corresponds to INDEX.
If we cannot determine the answer using ATTRS (e.g., if we need
to know what group the user is in), compute the return value by
calling FUNC with FILE as an argument."
- `(let ((owner (nth 2 ,attrs))
- (modes (nth 8 ,attrs)))
+ `(let ((owner (file-attribute-user-id ,attrs))
+ (modes (file-attribute-modes ,attrs)))
(cond ((cond ((numberp owner)
(= owner (user-uid)))
((stringp owner)
(defsubst eshell-ls-size-string (attrs size-width)
"Return the size string for ATTRS length, using SIZE-WIDTH."
- (let* ((str (eshell-ls-printable-size (nth 7 attrs) t))
+ (let* ((str (eshell-ls-printable-size (file-attribute-size attrs) t))
(len (length str)))
(if (< len size-width)
(concat (make-string (- size-width len) ? ) str)
(if numeric-uid-gid
"%s%4d %-8s %-8s "
"%s%4d %-14s %-8s ")
- (or (nth 8 attrs) "??????????")
- (or (nth 1 attrs) 0)
- (or (let ((user (nth 2 attrs)))
+ (or (file-attribute-modes attrs) "??????????")
+ (or (file-attribute-link-number attrs) 0)
+ (or (let ((user (file-attribute-user-id attrs)))
(and (stringp user)
(eshell-substring user 14)))
- (nth 2 attrs)
+ (file-attribute-user-id attrs)
"")
- (or (let ((group (nth 3 attrs)))
+ (or (let ((group (file-attribute-group-id attrs)))
(and (stringp group)
(eshell-substring group 8)))
- (nth 3 attrs)
+ (file-attribute-group-id attrs)
""))
- (let* ((str (eshell-ls-printable-size (nth 7 attrs)))
+ (let* ((str (eshell-ls-printable-size (file-attribute-size attrs)))
(len (length str)))
;; Let file sizes shorter than 9 align neatly.
(if (< len (or size-width 8))
(let ((total 0.0))
(setq size-width 0)
(dolist (e entries)
- (if (nth 7 (cdr e))
- (setq total (+ total (nth 7 (cdr e)))
+ (if (file-attribute-size (cdr e))
+ (setq total (+ total (file-attribute-size (cdr e)))
size-width
(max size-width
(length (eshell-ls-printable-size
- (nth 7 (cdr e))
+ (file-attribute-size (cdr e))
(not
;; If we are under -l, count length
;; of sizes in bytes, not in blocks.
(if (not show-size)
(setq display-files (mapcar 'eshell-ls-annotate files))
(dolist (file files)
- (let* ((str (eshell-ls-printable-size (nth 7 (cdr file)) t))
+ (let* ((str (eshell-ls-printable-size (file-attribute-size (cdr file)) t))
(len (length str)))
(if (< len size-width)
(setq str (concat (make-string (- size-width len) ? ) str)))
(if show-size
(max size-width
(length (eshell-ls-printable-size
- (nth 7 (cdr entry)) t))))))
+ (file-attribute-size (cdr entry)) t))))))
(setq dirs (cons entry dirs)))
(setq files (cons entry files)
size-width
(if show-size
(max size-width
(length (eshell-ls-printable-size
- (nth 7 (cdr entry)) t)))))))
+ (file-attribute-size (cdr entry)) t)))))))
(when files
(eshell-ls-files (eshell-ls-sort-entries files)
size-width show-recursive)
(?t . (eshell-pred-file-mode 1000)) ; sticky bit
(?U . #'(lambda (file) ; owned by effective uid
(if (file-exists-p file)
- (= (nth 2 (file-attributes file)) (user-uid)))))
+ (= (file-attribute-user-id (file-attributes file))
+ (user-uid)))))
;; (?G . #'(lambda (file) ; owned by effective gid
;; (if (file-exists-p file)
- ;; (= (nth 2 (file-attributes file)) (user-uid)))))
+ ;; (= (file-attribute-user-id (file-attributes file))
+ ;; (user-uid)))))
(?* . #'(lambda (file)
(and (file-regular-p file)
(not (file-symlink-p file))
`(lambda (file)
(let ((attrs (eshell-file-attributes (directory-file-name file))))
(if attrs
- (memq (aref (nth 8 attrs) 0)
+ (memq (aref (file-attribute-modes attrs) 0)
,(if (eq type ?%)
'(?b ?c)
(list 'quote (list type))))))))
'<
(if (eq qual ?+)
'>
- '=)) (nth 1 attrs) ,amount))))))
+ '=))
+ (file-attribute-link-number attrs) ,amount))))))
(defun eshell-pred-file-size ()
"Return a predicate to test whether a file is of a given size."
'<
(if (eq qual ?+)
'>
- '=)) (nth 7 attrs) ,amount))))))
+ '=))
+ (file-attribute-size attrs) ,amount))))))
(defun eshell-pred-substitute (&optional repeat)
"Return a modifier function that will substitute matches."
(or (not (eshell-under-windows-p))
(eq system-type 'ms-dos))
(setq attr (eshell-file-attributes (car files)))
- (nth 10 attr-target) (nth 10 attr)
- ;; Use equal, not -, since the inode and the device could
- ;; cons cells.
- (equal (nth 10 attr-target) (nth 10 attr))
- (nth 11 attr-target) (nth 11 attr)
- (equal (nth 11 attr-target) (nth 11 attr)))
+ (file-attribute-inode-number attr-target)
+ (file-attribute-inode-number attr)
+ (equal (file-attribute-inode-number attr-target)
+ (file-attribute-inode-number attr))
+ (file-attribute-device-number attr-target)
+ (file-attribute-device-number attr)
+ (equal (file-attribute-device-number attr-target)
+ (file-attribute-device-number attr)))
(eshell-error (format-message "%s: `%s' and `%s' are the same file\n"
command (car files) target)))
(t
(let (eshell-warn-dot-directories)
(if (and (not deep)
(eq func 'rename-file)
- ;; Use equal, since the device might be a
- ;; cons cell.
- (equal (nth 11 (eshell-file-attributes
- (file-name-directory
- (directory-file-name
- (expand-file-name source)))))
- (nth 11 (eshell-file-attributes
- (file-name-directory
- (directory-file-name
- (expand-file-name target)))))))
+ (equal (file-attribute-device-number
+ (eshell-file-attributes
+ (file-name-directory
+ (directory-file-name
+ (expand-file-name source)))))
+ (file-attribute-device-number
+ (eshell-file-attributes
+ (file-name-directory
+ (directory-file-name
+ (expand-file-name target)))))))
(apply 'eshell-funcalln func source target args)
(unless (file-directory-p target)
(if em-verbose
(> (length arg) 0)
(eq (aref arg 0) ?-))
(let ((attrs (eshell-file-attributes arg)))
- (and attrs (memq (aref (nth 8 attrs) 0)
+ (and attrs
+ (memq (aref (file-attribute-modes attrs) 0)
'(?d ?l ?-)))))
(throw 'special t)))))
(let ((ext-cat (eshell-search-path "cat")))
(unless (string-match "\\`\\.\\.?\\'" (caar entries))
(let* ((entry (concat path "/"
(caar entries)))
- (symlink (and (stringp (cadr (car entries)))
- (cadr (car entries)))))
+ (symlink (and (stringp (file-attribute-type (cdar entries)))
+ (file-attribute-type (cdar entries)))))
(unless (or (and symlink (not dereference-links))
(and only-one-filesystem
(/= only-one-filesystem
- (nth 12 (car entries)))))
+ (file-attribute-device-number (cdar entries)))))
(if symlink
(setq entry symlink))
(setq size
(+ size
- (if (eq t (cadr (car entries)))
+ (if (eq t (car (cdar entries)))
(eshell-du-sum-directory entry (1+ depth))
- (let ((file-size (nth 8 (car entries))))
+ (let ((file-size (file-attribute-size (cdar entries))))
(prog1
file-size
(if show-all
(while args
(if only-one-filesystem
(setq only-one-filesystem
- (nth 11 (eshell-file-attributes
+ (file-attribute-device-number (eshell-file-attributes
(file-name-as-directory (car args))))))
(setq size (+ size (eshell-du-sum-directory
(directory-file-name (car args)) 0)))
(not (symbol-value timestamp-var))
(time-less-p
(symbol-value timestamp-var)
- (nth 5 (file-attributes file))))
+ (file-attribute-modification-time (file-attributes file))))
(progn
(set result-var (eshell-read-passwd-file file))
(set timestamp-var (current-time))))
(not (symbol-value timestamp-var))
(time-less-p
(symbol-value timestamp-var)
- (nth 5 (file-attributes file))))
+ (file-attribute-modification-time (file-attributes file))))
(progn
(set result-var (eshell-read-hosts-file file))
(set timestamp-var (current-time))))
(defun display-time-file-nonempty-p (file)
(let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
(and (file-exists-p file)
- (< 0 (nth 7 (file-attributes (file-chase-links file)))))))"
+ (< 0 (file-attribute-size
+ (file-attributes (file-chase-links file)))))))"
:group 'files
:version "24.1"
:type `(choice
;; Check to see if the file looks uncommonly large.
(when (not (or buf nowarn))
(when (eq (abort-if-file-too-large
- (nth 7 attributes) "open" filename t)
+ (file-attribute-size attributes) "open" filename t)
'raw)
(setf rawfile t))
- (warn-maybe-out-of-memory (nth 7 attributes)))
+ (warn-maybe-out-of-memory (file-attribute-size attributes)))
(if buf
;; We are using an existing buffer.
(let (nonexistent)
(signal 'file-error (list "Opening input file" "Is a directory"
filename)))
;; Check whether the file is uncommonly large
- (abort-if-file-too-large (nth 7 (file-attributes filename)) "insert" filename)
+ (abort-if-file-too-large (file-attribute-size (file-attributes filename))
+ "insert" filename)
(let* ((buffer (find-buffer-visiting (abbreviate-file-name (file-truename filename))
#'buffer-modified-p))
(tem (funcall insert-func filename)))
DIR is the name of the directory.
CLASS is the name of a variable class (a symbol).
MTIME is the recorded modification time of the directory-local
-variables file associated with this entry. This time is a list
-of integers (the same format as `file-attributes'), and is
+variables file associated with this entry. This time is a Lisp
+timestamp (the same format as `current-time'), and is
used to test whether the cache entry is still valid.
Alternatively, MTIME can be nil, which means the entry is always
considered valid.")
(equal (nth 2 dir-elt)
(let ((latest 0))
(dolist (f cached-files latest)
- (let ((f-time (nth 5 (file-attributes f))))
+ (let ((f-time
+ (file-attribute-modification-time
+ (file-attributes f))))
(if (time-less-p latest f-time)
(setq latest f-time)))))))))
;; This cache entry is OK.
(variables))
(with-demoted-errors "Error reading dir-locals: %S"
(dolist (file files)
- (let ((file-time (nth 5 (file-attributes file))))
+ (let ((file-time (file-attribute-modification-time
+ (file-attributes file))))
(if (time-less-p latest file-time)
(setq latest file-time)))
(with-temp-buffer
(let ((attr (file-attributes
real-file-name
'integer)))
- (<= (nth 2 attr)
+ (<= (file-attribute-user-id attr)
copy-when-priv-mismatch))))
(not (file-ownership-preserved-p real-file-name
t)))))
;; Return t if the file doesn't exist, since it's true that no
;; information would be lost by an (attempted) delete and create.
(or (null attributes)
- (and (or (= (nth 2 attributes) (user-uid))
+ (and (or (= (file-attribute-user-id attributes) (user-uid))
;; Files created on Windows by Administrator (RID=500)
;; have the Administrators group (RID=544) recorded as
;; their owner. Rewriting them will still preserve the
;; owner.
(and (eq system-type 'windows-nt)
- (= (user-uid) 500) (= (nth 2 attributes) 544)))
+ (= (user-uid) 500)
+ (= (file-attribute-user-id attributes) 544)))
(or (not group)
;; On BSD-derived systems files always inherit the parent
;; directory's group, so skip the group-gid test.
(memq system-type '(berkeley-unix darwin gnu/kfreebsd))
- (= (nth 3 attributes) (group-gid)))
+ (= (file-attribute-group-id attributes) (group-gid)))
(let* ((parent (or (file-name-directory file) "."))
(parent-attributes (file-attributes parent 'integer)))
(and parent-attributes
;; On some systems, a file created in a setuid directory
;; inherits that directory's owner.
(or
- (= (nth 2 parent-attributes) (user-uid))
- (string-match "^...[^sS]" (nth 8 parent-attributes)))
+ (= (file-attribute-user-id parent-attributes)
+ (user-uid))
+ (string-match
+ "^...[^sS]"
+ (file-attribute-modes parent-attributes)))
;; On many systems, a file created in a setgid directory
;; inherits that directory's group. On some systems
;; this happens even if the setgid bit is not set.
(or (not group)
- (= (nth 3 parent-attributes)
- (nth 3 attributes)))))))))))
+ (= (file-attribute-group-id parent-attributes)
+ (file-attribute-group-id attributes)))))))))))
(defun file-name-sans-extension (filename)
"Return FILENAME sans final \"extension\".
;; Set directory attributes.
(let ((modes (file-modes directory))
- (times (and keep-time (nth 5 (file-attributes directory)))))
+ (times (and keep-time (file-attribute-modification-time
+ (file-attributes directory)))))
(if modes (set-file-modes newname modes))
(if times (set-file-times newname times))))))
(let* ((modes (or (if orig-file (file-modes orig-file) 0)
(error "File not found")))
(modestr (and (stringp orig-file)
- (nth 8 (file-attributes orig-file))))
+ (file-attribute-modes (file-attributes orig-file))))
(default
(and (stringp modestr)
(string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr)
(defsubst file-attribute-access-time (attributes)
"The last access time in ATTRIBUTES returned by `file-attributes'.
-This a list of integers (HIGH LOW USEC PSEC) in the same style
-as (current-time)."
+This a Lisp timestamp in the style of `current-time'."
(nth 4 attributes))
(defsubst file-attribute-modification-time (attributes)
"The modification time in ATTRIBUTES returned by `file-attributes'.
This is the time of the last change to the file's contents, and
-is a list of integers (HIGH LOW USEC PSEC) in the same style
-as (current-time)."
+is a Lisp timestamp in the style of `current-time'."
(nth 5 attributes))
(defsubst file-attribute-status-change-time (attributes)
"The status modification time in ATTRIBUTES returned by `file-attributes'.
This is the time of last change to the file's attributes: owner
-and group, access mode bits, etc, and is a list of integers (HIGH
-LOW USEC PSEC) in the same style as (current-time)."
+and group, access mode bits, etc., and is a Lisp timestamp in the
+style of `current-time'."
(nth 6 attributes))
(defsubst file-attribute-size (attributes)
- "The size (in bytes) in ATTRIBUTES returned by `file-attributes'.
-This is a floating point number if the size is too large for an integer."
+ "The integer size (in bytes) in ATTRIBUTES returned by `file-attributes'."
(nth 7 attributes))
(defsubst file-attribute-modes (attributes)
(defsubst file-attribute-inode-number (attributes)
"The inode number in ATTRIBUTES returned by `file-attributes'.
-If it is larger than what an Emacs integer can hold, this is of
-the form (HIGH . LOW): first the high bits, then the low 16 bits.
-If even HIGH is too large for an Emacs integer, this is instead
-of the form (HIGH MIDDLE . LOW): first the high bits, then the
-middle 24 bits, and finally the low 16 bits."
+It is a nonnegative integer."
(nth 10 attributes))
(defsubst file-attribute-device-number (attributes)
"The file system device number in ATTRIBUTES returned by `file-attributes'.
-If it is larger than what an Emacs integer can hold, this is of
-the form (HIGH . LOW): first the high bits, then the low 16 bits.
-If even HIGH is too large for an Emacs integer, this is instead
-of the form (HIGH MIDDLE . LOW): first the high bits, then the
-middle 24 bits, and finally the low 16 bits."
+It is an integer."
(nth 11 attributes))
(defun file-attribute-collect (attributes &rest attr-names)
"Format one line of long ls output for file FILE-NAME.
FILE-ATTR and FILE-SIZE give the file's attributes and size.
SWITCHES and TIME-INDEX give the full switch list and time data."
- (let ((file-type (nth 0 file-attr)))
+ (let ((file-type (file-attribute-type file-attr)))
(concat (if (memq ?i switches) ; inode number
- (format "%6d " (nth 10 file-attr)))
+ (format "%6d " (file-attribute-inode-number file-attr)))
;; nil is treated like "" in concat
(if (memq ?s switches) ; size in K
- (format "%4d " (1+ (/ (nth 7 file-attr) 1024))))
- (nth 8 file-attr) ; permission bits
+ (format "%4d " (1+ (/ (file-attribute-size file-attr) 1024))))
+ (file-attribute-modes file-attr)
(format " %3d %-8s %-8s %8d "
- (nth 1 file-attr) ; no. of links
- (if (numberp (nth 2 file-attr))
- (int-to-string (nth 2 file-attr))
- (nth 2 file-attr)) ; uid
+ (file-attribute-link-number file-attr)
+ (if (numberp (file-attribute-user-id file-attr))
+ (int-to-string (file-attribute-user-id file-attr))
+ (file-attribute-user-id file-attr))
(if (eq system-type 'ms-dos)
"root" ; everything is root on MSDOS.
- (if (numberp (nth 3 file-attr))
- (int-to-string (nth 3 file-attr))
- (nth 3 file-attr))) ; gid
- (nth 7 file-attr) ; size in bytes
+ (if (numberp (file-attribute-group-id file-attr))
+ (int-to-string (file-attribute-group-id file-attr))
+ (file-attribute-group-id file-attr)))
+ (file-attribute-size file-attr)
)
(find-lisp-format-time file-attr switches now)
" "
(number-to-string have-this)))
(size-file
(float (or (and gnus-agent-total-fetched-hashtb
- (nth 7 (file-attributes file-name)))
+ (file-attribute-size
+ (file-attributes file-name)))
0)))
(file-name-coding-system
nnmail-pathname-coding-system))
(let* (alist
(file-name-coding-system nnmail-pathname-coding-system)
(file-attributes (directory-files-and-attributes
- (gnus-agent-article-name ""
- gnus-agent-read-agentview) nil "^[0-9]+$" t)))
+ (gnus-agent-article-name
+ "" gnus-agent-read-agentview)
+ nil "^[0-9]+$" t)))
(while file-attributes
(let ((fa (pop file-attributes)))
- (unless (nth 1 fa)
- (push (cons (string-to-number (nth 0 fa)) (time-to-days (nth 5 fa))) alist))))
+ (unless (file-attribute-type (cdr fa))
+ (push (cons (string-to-number (car fa))
+ (time-to-days
+ (file-attribute-access-time (cdr fa))))
+ alist))))
alist)
(file-error nil))))))
(ignore-errors ; Just being paranoid.
(let* ((file-name (nnheader-concat dir (number-to-string
article-number)))
- (size (float (nth 7 (file-attributes file-name)))))
+ (size (float (file-attribute-size
+ (file-attributes file-name)))))
(cl-incf bytes-freed size)
(cl-incf size-files-deleted size)
(cl-incf files-deleted)
(buffer-read-only nil)
(file-name-coding-system nnmail-pathname-coding-system))
(when (and (file-exists-p file)
- (> (nth 7 (file-attributes file)) 0))
+ (> (file-attribute-size (file-attributes file)) 0))
(erase-buffer)
(gnus-kill-all-overlays)
(let ((coding-system-for-read gnus-cache-coding-system))
;; This entry in the overview has been downloaded
(push (cons (car downloaded)
(time-to-days
- (nth 5 (file-attributes
- (concat dir (number-to-string
- (car downloaded))))))) alist)
+ (file-attribute-modification-time
+ (file-attributes
+ (concat dir (number-to-string
+ (car downloaded)))))))
+ alist)
(setq downloaded (cdr downloaded))
(setq nov-arts (cdr nov-arts)))
(t
(let ((sum 0.0)
file)
(while (setq file (pop delta))
- (cl-incf sum (float (or (nth 7 (file-attributes
- (nnheader-concat
- path
- (if (numberp file)
- (number-to-string file)
- file)))) 0))))
+ (cl-incf sum (float (or (file-attribute-size
+ (file-attributes
+ (nnheader-concat
+ path
+ (if (numberp file)
+ (number-to-string file)
+ file))))
+ 0))))
(setq delta sum))
(let ((sum (- (nth 2 entry)))
(info (directory-files-and-attributes
path nil "^-?[0-9]+$" t))
file)
(while (setq file (pop info))
- (cl-incf sum (float (or (nth 8 file) 0))))
+ (cl-incf sum (float (or (file-attribute-size (cdr file)) 0))))
(setq delta sum))))
(setq gnus-agent-need-update-total-fetched-for t)
(gnus-sethash path (make-list 3 0)
gnus-agent-total-fetched-hashtb)))
(file-name-coding-system nnmail-pathname-coding-system)
- (size (or (nth 7 (file-attributes
- (nnheader-concat
- path (if agent-over
- ".overview"
- ".agentview"))))
+ (size (or (file-attribute-size (file-attributes
+ (nnheader-concat
+ path (if agent-over
+ ".overview"
+ ".agentview"))))
0)))
(setq gnus-agent-need-update-total-fetched-for t)
(setf (nth (if agent-over 1 0) entry) size)))))
"Read the cache active file."
(gnus-make-directory gnus-cache-directory)
(if (or (not (file-exists-p gnus-cache-active-file))
- (zerop (nth 7 (file-attributes gnus-cache-active-file)))
+ (zerop (file-attribute-size
+ (file-attributes gnus-cache-active-file)))
force)
;; There is no active file, so we generate one.
(gnus-cache-generate-active)
size)
(if file
- (setq size (or (nth 7 (file-attributes file)) 0))
+ (setq size (or (file-attribute-size (file-attributes file)) 0))
(let* ((file-name-coding-system nnmail-pathname-coding-system)
(files (directory-files (gnus-cache-file-name group "")
t nil t))
(setq size 0.0)
(while (setq file (pop files))
(setq attrs (file-attributes file))
- (unless (nth 0 attrs)
- (cl-incf size (float (nth 7 attrs)))))))
+ (unless (file-attribute-type attrs)
+ (cl-incf size (float (file-attribute-size attrs)))))))
(setq gnus-cache-need-update-total-fetched-for t)
(gnus-sethash group (make-list 2 0)
gnus-cache-total-fetched-hashtb)))
(file-name-coding-system nnmail-pathname-coding-system)
- (size (or (nth 7 (file-attributes
+ (size (or (file-attribute-size (file-attributes
(or file
(gnus-cache-file-name group ".overview"))))
0)))
(format-time-string "%FT%T%z" time))
(defun gnus-cloud-file-new-p (file full)
- (let ((timestamp (gnus-cloud-timestamp (nth 5 (file-attributes file))))
+ (let ((timestamp (gnus-cloud-timestamp (file-attribute-modification-time
+ (file-attributes file))))
(old (cadr (assoc file gnus-cloud-file-timestamps))))
(when (or full
(null old)
(gnus-file-newer-than gnus-kill-files-directory
(car gnus-score-file-list)))
(setq gnus-score-file-list
- (cons (nth 5 (file-attributes gnus-kill-files-directory))
+ (cons (file-attribute-modification-time
+ (file-attributes gnus-kill-files-directory))
(nreverse
(directory-files
gnus-kill-files-directory t
;; Check timestamp of `gnus-current-startup-file'.eld against
;; `gnus-save-newsrc-file-last-timestamp'.
(if (let* ((checkfile (concat gnus-current-startup-file ".eld"))
- (mtime (nth 5 (file-attributes checkfile))))
+ (mtime (file-attribute-modification-time
+ (file-attributes checkfile))))
(and gnus-save-newsrc-file-last-timestamp
(time-less-p gnus-save-newsrc-file-last-timestamp
mtime)
(gnus-run-hooks 'gnus-save-quick-newsrc-hook)
(save-buffer)
(setq gnus-save-newsrc-file-last-timestamp
- (nth 5 (file-attributes buffer-file-name))))
+ (file-attribute-modification-time
+ (file-attributes buffer-file-name))))
(let ((coding-system-for-write gnus-ding-file-coding-system)
(version-control gnus-backup-startup-file)
(startup-file (concat gnus-current-startup-file ".eld"))
(rename-file working-file startup-file t)
(gnus-set-file-modes startup-file setmodes)
(setq gnus-save-newsrc-file-last-timestamp
- (nth 5 (file-attributes startup-file)))))
+ (file-attribute-modification-time
+ (file-attributes startup-file)))))
(condition-case nil
(delete-file working-file)
(file-error nil)))))
(with-current-buffer (gnus-get-buffer-create " *gnus slave*")
(setq slave-files
(sort (mapcar (lambda (file)
- (list (nth 5 (file-attributes file)) file))
+ (list (file-attribute-modification-time
+ (file-attributes file))
+ file))
slave-files)
(lambda (f1 f2)
- (or (< (caar f1) (caar f2))
- (< (nth 1 (car f1)) (nth 1 (car f2)))))))
+ (time-less-p (car f1) (car f2)))))
(while slave-files
(erase-buffer)
(setq file (nth 1 (car slave-files)))
(unless (re-search-forward "^date:" nil t)
(goto-char (point-max))
(setq atts (file-attributes file))
- (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
+ (insert "Date: " (message-make-date
+ (file-attribute-modification-time atts))
+ "\n")))
;; This doesn't look like an article, so we fudge some headers.
(setq atts (file-attributes file)
lines (count-lines (point-min) (point-max)))
(insert "From: " (read-string "From: ") "\n"
"Subject: " (read-string "Subject: ") "\n"
- "Date: " (message-make-date (nth 5 atts)) "\n"
+ "Date: " (message-make-date
+ (file-attribute-modification-time atts)) "\n"
"Message-ID: " (message-make-message-id) "\n"
"Lines: " (int-to-string lines) "\n"
- "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
+ "Chars: " (int-to-string (file-attribute-size atts)) "\n\n"))
(setq group-art (gnus-request-accept-article group nil t))
(kill-buffer (current-buffer)))
(setq gnus-newsgroup-active (gnus-activate-group group))
;;; Time functions.
(defun gnus-file-newer-than (file date)
- (let ((fdate (nth 5 (file-attributes file))))
- (or (> (car fdate) (car date))
- (and (= (car fdate) (car date))
- (> (nth 1 fdate) (nth 1 date))))))
+ (time-less-p date (file-attribute-modification-time (file-attributes file))))
;;; Keymap macros.
(defun gnus-cache-file-contents (file variable function)
"Cache the contents of FILE in VARIABLE. The contents come from FUNCTION."
- (let ((time (nth 5 (file-attributes file)))
+ (let ((time (file-attribute-modification-time (file-attributes file)))
contents value)
(if (or (null (setq value (symbol-value variable)))
(not (equal (car value) file))
(let* ((ffile (car files))
(bfile (replace-regexp-in-string "\\`.*/\\([^/]+\\)\\'" "\\1"
ffile))
- (filetime (nth 5 (file-attributes ffile))))
+ (filetime (file-attribute-modification-time
+ (file-attributes ffile))))
(setq files (cdr files))
(when (and (> (time-to-number-of-days (time-subtract now filetime))
diff)
(defun mail-source-callback (callback info)
"Call CALLBACK on the mail file. Pass INFO on to CALLBACK."
(if (or (not (file-exists-p mail-source-crash-box))
- (zerop (nth 7 (file-attributes mail-source-crash-box))))
+ (zerop (file-attribute-size
+ (file-attributes mail-source-crash-box))))
(progn
(when (file-exists-p mail-source-crash-box)
(delete-file mail-source-crash-box))
((not (file-exists-p from))
;; There is no inbox.
(setq to nil))
- ((zerop (nth 7 (file-attributes from)))
+ ((zerop (file-attribute-size (file-attributes from)))
;; Empty file.
(setq to nil))
(t
(setq nneething-map
(mapcar (lambda (n)
(list (cdr n) (car n)
- (nth 5 (file-attributes
- (nneething-file-name (car n))))))
+ (file-attribute-modification-time
+ (file-attributes
+ (nneething-file-name (car n))))))
nneething-map)))
;; Remove files matching the exclusion regexp.
(when nneething-exclude-files
(while map
(if (and (member (cadr (car map)) files)
;; We also remove files that have changed mod times.
- (equal (nth 5 (file-attributes
+ (equal (file-attribute-modification-time (file-attributes
(nneething-file-name (cadr (car map)))))
(cadr (cdar map))))
(progn
(setq touched t)
(setcdr nneething-active (1+ (cdr nneething-active)))
(push (list (cdr nneething-active) (car files)
- (nth 5 (file-attributes
+ (file-attribute-modification-time (file-attributes
(nneething-file-name (car files)))))
nneething-map))
(setq files (cdr files)))
"Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
"Message-ID: <nneething-" (nneething-encode-file-name file)
"@" (system-name) ">\n"
- (if (equal '(0 0) (nth 5 atts)) ""
- (concat "Date: " (current-time-string (nth 5 atts)) "\n"))
+ (if (zerop (float-time (file-attribute-modification-time atts))) ""
+ (concat "Date: "
+ (current-time-string (file-attribute-modification-time atts))
+ "\n"))
(or (when buffer
(with-current-buffer buffer
(when (re-search-forward "<[a-zA-Z0-9_]@[-a-zA-Z0-9_]>" 1000 t)
(concat "From: " (match-string 0) "\n"))))
- (nneething-from-line (nth 2 atts) file))
- (if (> (string-to-number (int-to-string (nth 7 atts))) 0)
- (concat "Chars: " (int-to-string (nth 7 atts)) "\n")
+ (nneething-from-line (file-attribute-user-id atts) file))
+ (if (> (file-attribute-size atts) 0)
+ (concat "Chars: " (int-to-string (file-attribute-size atts)) "\n")
"")
(if buffer
(with-current-buffer buffer
(mm-enable-multibyte) ;; Use multibyte buffer for future copying.
(buffer-disable-undo)
(if (equal (cadr (assoc group nnfolder-scantime-alist))
- (nth 5 (file-attributes file)))
+ (file-attribute-modification-time (file-attributes file)))
;; This looks up-to-date, so we don't do any scanning.
(if (file-exists-p file)
buffer
(defun nnheader-file-size (file)
"Return the file size of FILE or 0."
- (or (nth 7 (file-attributes file)) 0))
+ (or (file-attribute-size (file-attributes file)) 0))
(defun nnheader-find-etc-directory (package &optional file first)
"Go through `load-path' and find the \"../etc/PACKAGE\" directory.
(mm-insert-file-contents filename visit beg end replace)))
(defun nnheader-insert-nov-file (file first)
- (let ((size (nth 7 (file-attributes file)))
+ (let ((size (file-attribute-size (file-attributes file)))
(cutoff (* 32 1024)))
(when size
(if (< size cutoff)
(and (setq file (ignore-errors
(symbol-value (intern (format "%s-active-file"
backend)))))
- (setq file-time (nth 5 (file-attributes file)))
+ (setq file-time (file-attribute-modification-time
+ (file-attributes file)))
(or (not
(setq timestamp
(condition-case ()
(setq attr (file-attributes
(concat dir (number-to-string number-opened))))
(or attr (throw 'return (1- number-opened)))
- (setq ino-opened (nth 10 attr)
- nlink (nth 1 attr)
+ (setq ino-opened (file-attribute-inode-number attr)
+ nlink (file-attribute-link-number attr)
number-linked (+ number-opened nlink))
(if (or (< nlink 1) (< number-linked nlink))
(signal 'error '("Arithmetic overflow")))
(setq attr (file-attributes
(concat dir (number-to-string number-linked))))
(or attr (throw 'return (1- number-linked)))
- (unless (equal ino-opened (nth 10 attr))
+ (unless (equal ino-opened (file-attribute-inode-number attr))
(setq number-opened number-linked))))))
;; Make the given server, if non-nil, be the current server. Then make the
(setq make-new-file nil
previous-number-link 0))
(let* ((attr (file-attributes path-open))
- (nlink (nth 1 attr)))
- (setq ino-open (nth 10 attr)
+ (nlink (file-attribute-link-number attr)))
+ (setq ino-open (file-attribute-inode-number attr)
number-link (+ number-open nlink))
(if (or (< nlink 1) (< number-link nlink))
(signal 'error '("Arithmetic overflow"))))
number-open number-link))
((nnmaildir--eexist-p err)
(let ((attr (file-attributes path-link)))
- (unless (equal (nth 10 attr) ino-open)
+ (unless (equal (file-attribute-inode-number attr) ino-open)
(setq number-open number-link
number-link 0))))
(t (signal (car err) (cdr err)))))))))
(unless attr
(nnmaildir--expired-article group article)
(throw 'return nil))
- (setq mtime (nth 5 attr)
- attr (nth 7 attr)
+ (setq mtime (file-attribute-modification-time attr)
+ attr (file-attribute-size attr)
nov (nnmaildir--art-nov article)
dir (nnmaildir--nndir dir)
novdir (nnmaildir--nov-dir dir)
(setq read-only (nnmaildir--param pgname 'read-only)
ls (or (nnmaildir--param pgname 'directory-files) srv-ls))
(unless read-only
- (setq x (nth 11 (file-attributes tdir)))
- (unless (and (equal x (nth 11 nattr)) (equal x (nth 11 cattr)))
+ (setq x (file-attribute-device-number (file-attributes tdir)))
+ (unless (and (equal x (file-attribute-device-number nattr))
+ (equal x (file-attribute-device-number cattr)))
(setf (nnmaildir--srv-error nnmaildir--cur-server)
(concat "Maildir spans filesystems: " absdir))
(throw 'return nil))
(dolist (file (funcall ls tdir 'full "\\`[^.]" 'nosort))
(setq x (file-attributes file))
- (if (or (> (cadr x) 1) (time-less-p (nth 4 x) 36h-ago))
+ (if (or (> (file-attribute-link-number x) 1)
+ (time-less-p (file-attribute-access-time x) 36h-ago))
(delete-file file))))
(or scan-msgs
isnew
(throw 'return t))
- (setq nattr (nth 5 nattr))
+ (setq nattr (file-attribute-modification-time nattr))
(if (equal nattr (nnmaildir--grp-new group))
(setq nattr nil))
(if read-only (setq dir (and (or isnew nattr) ndir))
(when (or isnew nattr)
(dolist (file (funcall ls ndir nil "\\`[^.]" 'nosort))
(setq x (concat ndir file))
- (and (time-less-p (nth 5 (file-attributes x)) nil)
+ (and (time-less-p (file-attribute-modification-time
+ (file-attributes x))
+ nil)
(rename-file x (concat cdir (nnmaildir--ensure-suffix file)))))
(setf (nnmaildir--grp-new group) nattr))
- (setq cattr (nth 5 (file-attributes cdir)))
+ (setq cattr (file-attribute-modification-time (file-attributes cdir)))
(if (equal cattr (nnmaildir--grp-cur group))
(setq cattr nil))
(setq dir (and (or isnew cattr) cdir)))
(if (nnmaildir--srv-gnm nnmaildir--cur-server)
(nnmail-get-new-mail 'nnmaildir nil nil scan-group))
(unintern scan-group groups))
- (setq x (nth 5 (file-attributes srv-dir))
+ (setq x (file-attribute-modification-time (file-attributes srv-dir))
scan-group (null scan-group))
(if (equal x (nnmaildir--srv-mtime nnmaildir--cur-server))
(if scan-group
(dolist (grp x)
(unintern grp groups))
(setf (nnmaildir--srv-mtime nnmaildir--cur-server)
- (nth 5 (file-attributes srv-dir))))
+ (file-attribute-modification-time (file-attributes srv-dir))))
(and scan-group
(nnmaildir--srv-gnm nnmaildir--cur-server)
(nnmail-get-new-mail 'nnmaildir nil nil))))))
(curdir (nnmaildir--cur
(nnmaildir--srvgrp-dir
(nnmaildir--srv-dir nnmaildir--cur-server) gname)))
- (curdir-mtime (nth 5 (file-attributes curdir)))
+ (curdir-mtime (file-attribute-modification-time (file-attributes curdir)))
pgname flist always-marks never-marks old-marks dir
all-marks marks ranges markdir read ls
old-mmth new-mmth mtime existing missing deactivate-mark)
;; a filename flag, get the later of the mtimes for markdir and
;; curdir, otherwise only the markdir counts.
(setq mtime
- (let ((markdir-mtime (nth 5 (file-attributes markdir))))
+ (let ((markdir-mtime (file-attribute-modification-time (file-attributes markdir))))
(cond
((null (nnmaildir--mark-to-flag mark))
markdir-mtime)
(nnmaildir--expired-article group article))
((and no-force
(progn
- (setq time (nth 5 time)
+ (setq time (file-attribute-modification-time time)
bound-iter boundary)
(while (and bound-iter time
(= (car bound-iter) (car time)))
min rdir num subdirectoriesp file)
;; Recurse down directories.
(setq subdirectoriesp
- ;; nth 1 of file-attributes always 1 on MS Windows :(
- (/= (nth 1 (file-attributes (file-truename dir))) 2))
+ ;; link number always 1 on MS Windows :(
+ (/= (file-attribute-link-number
+ (file-attributes (file-truename dir)))
+ 2))
(dolist (rdir files)
(if (or (not subdirectoriesp)
(file-regular-p rdir))
(while (and articles is-old)
(setq article (concat dir (int-to-string (car articles))))
- (when (setq mod-time (nth 5 (file-attributes article)))
+ (when (setq mod-time (file-attribute-modification-time
+ (file-attributes article)))
(if (and (nnmh-deletable-article-p newsgroup (car articles))
(setq is-old
(nnmail-expired-article-p newsgroup mod-time force)))
art)
(while (setq art (pop arts))
(when (not (equal
- (nth 5 (file-attributes
- (concat dir (int-to-string (car art)))))
+ (file-attribute-modification-time
+ (file-attributes (concat dir (int-to-string (car art)))))
(cdr art)))
(setq articles (delq art articles))
(push (car art) new))))
(mapcar
(lambda (art)
(cons art
- (nth 5 (file-attributes
- (concat dir (int-to-string art))))))
+ (file-attribute-modification-time
+ (file-attributes
+ (concat dir (int-to-string art))))))
new)))
;; Make Gnus mark all new articles as unread.
(when new
(while (and articles is-old)
(if (and (setq article (nnml-article-to-file
(setq number (pop articles))))
- (setq mod-time (nth 5 (file-attributes article)))
+ (setq mod-time (file-attribute-modification-time
+ (file-attributes article)))
(nnml-deletable-article-p group number)
(setq is-old (nnmail-expired-article-p group mod-time force
nnml-inhibit-expiry)))
;; Learn spam: (spam-stat-process-spam-directory "~/Mail/mail/spam")
;; Learn non-spam: (spam-stat-process-non-spam-directory "~/Mail/mail/misc")
;; Save table: (spam-stat-save)
-;; File size: (nth 7 (file-attributes spam-stat-file))
+;; File size: (file-attribute-size (file-attributes spam-stat-file))
;; Number of words: (hash-table-count spam-stat)
;; Test spam: (spam-stat-test-directory "~/Mail/mail/spam")
;; Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc")
;; Reduce table size: (spam-stat-reduce-size)
;; Save table: (spam-stat-save)
-;; File size: (nth 7 (file-attributes spam-stat-file))
+;; File size: (file-attribute-size (file-attributes spam-stat-file))
;; Number of words: (hash-table-count spam-stat)
;; Test spam: (spam-stat-test-directory "~/Mail/mail/spam")
;; Test non-spam: (spam-stat-test-directory "~/Mail/mail/misc")
(insert ")))"))))
(message "Saved %s." spam-stat-file)
(setq spam-stat-dirty nil
- spam-stat-last-saved-at (nth 5 (file-attributes spam-stat-file)))))
+ spam-stat-last-saved-at (file-attribute-modification-time
+ (file-attributes spam-stat-file)))))
(defun spam-stat-load ()
"Read the `spam-stat' hash table from disk."
((or (not (boundp 'spam-stat-last-saved-at))
(null spam-stat-last-saved-at)
(not (equal spam-stat-last-saved-at
- (nth 5 (file-attributes spam-stat-file)))))
+ (file-attribute-modification-time
+ (file-attributes spam-stat-file)))))
(progn
(load-file spam-stat-file)
(setq spam-stat-dirty nil
spam-stat-last-saved-at
- (nth 5 (file-attributes spam-stat-file)))))
+ (file-attribute-modification-time
+ (file-attributes spam-stat-file)))))
(t (message "Spam stat file not loaded: no change in disk.")))))
(defun spam-stat-to-hash-table (entries)
(dolist (f files)
(when (and (file-readable-p f)
(file-regular-p f)
- (> (nth 7 (file-attributes f)) 0)
- (< (time-to-number-of-days (time-since (nth 5 (file-attributes f))))
+ (> (file-attribute-size (file-attributes f)) 0)
+ (< (time-to-number-of-days
+ (time-since (file-attribute-modification-time
+ (file-attributes f))))
spam-stat-process-directory-age))
(setq count (1+ count))
(message "Reading %s: %.2f%%" dir (/ count max))
(dolist (f files)
(when (and (file-readable-p f)
(file-regular-p f)
- (> (nth 7 (file-attributes f)) 0))
+ (> (file-attribute-size (file-attributes f)) 0))
(setq count (1+ count))
(message "Reading %.2f%%, score %.2f"
(/ count max) (/ score count))
(ido-final-slash dir)
(not (ido-is-unc-host dir))
(file-directory-p dir)
- (> (nth 7 (file-attributes (file-truename dir))) ido-max-directory-size))))
+ (> (file-attribute-size (file-attributes (file-truename dir)))
+ ido-max-directory-size))))
(defun ido-set-current-directory (dir &optional subdir no-merge)
;; Set ido's current directory to DIR or DIR/SUBDIR
(ftp (ido-is-ftp-directory dir))
(unc (ido-is-unc-host dir))
(attr (if (or ftp unc) nil (file-attributes dir)))
- (mtime (nth 5 attr))
+ (mtime (file-attribute-modification-time attr))
valid)
(when cached ; should we use the cached entry ?
(cond
(let* ((thumb-file (image-dired-thumb-name file))
(thumb-attr (file-attributes thumb-file)))
(when (or (not thumb-attr)
- (time-less-p (nth 5 thumb-attr)
- (nth 5 (file-attributes file))))
+ (time-less-p (file-attribute-modification-time thumb-attr)
+ (file-attribute-modification-time
+ (file-attributes file))))
(image-dired-create-thumb file thumb-file))
(create-image thumb-file)
;; (list 'image :type 'jpeg
(let* ((width (int-to-string (image-dired-thumb-size 'width)))
(height (int-to-string (image-dired-thumb-size 'height)))
(modif-time (format-time-string
- "%s" (nth 5 (file-attributes original-file))))
+ "%s" (file-attribute-modification-time
+ (file-attributes original-file))))
(thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
thumbnail-file))
(spec
;; (mapcar
;; (lambda (f)
;; (let ((fattribs (file-attributes f)))
-;; ;; Get last access time and file size
-;; `(,(nth 4 fattribs) ,(nth 7 fattribs) ,f)))
+;; `(,(file-attribute-access-time fattribs)
+;; ,(file-attribute-size fattribs) ,f)))
;; (directory-files (image-dired-dir) t ".+\\.thumb\\..+$"))
;; ;; Sort function. Compare time between two files.
;; (lambda (l1 l2)
;; Clear the caches of modified Info files.
(let* ((attribs-old (cdr (assoc fullname Info-file-attributes)))
- (modtime-old (and attribs-old (nth 5 attribs-old)))
+ (modtime-old (and attribs-old
+ (file-attribute-modification-time attribs-old)))
(attribs-new (and (stringp fullname) (file-attributes fullname)))
- (modtime-new (and attribs-new (nth 5 attribs-new))))
+ (modtime-new (and attribs-new
+ (file-attribute-modification-time attribs-new))))
(when (and modtime-old modtime-new
(time-less-p modtime-old modtime-new))
(setq Info-index-nodes (remove (assoc (or Info-current-file filename)
;; files we are about to display.
(dolist (elt file-alist)
(setq attr (cdr elt)
- fuid (nth 2 attr)
+ fuid (file-attribute-user-id attr)
uid-len (if (stringp fuid) (string-width fuid)
(length (format "%d" fuid)))
- fgid (nth 3 attr)
+ fgid (file-attribute-group-id attr)
gid-len (if (stringp fgid) (string-width fgid)
(length (format "%d" fgid)))
- file-size (nth 7 attr))
+ file-size (file-attribute-size attr))
(if (> uid-len max-uid-len)
(setq max-uid-len uid-len))
(if (> gid-len max-gid-len)
files (cdr files)
short (car elt)
attr (cdr elt)
- file-size (nth 7 attr))
+ file-size (file-attribute-size attr))
(and attr
(setq sum (+ file-size
;; Even if neither SUM nor file's size
(if (memq ?F switches)
(ls-lisp-classify-file file fattr)
file)
- fattr (nth 7 fattr)
+ fattr (file-attribute-size fattr)
switches time-index))
(message "%s: doesn't exist or is inaccessible" file)
(ding) (sit-for 2))))) ; to show user the message!
(sort (copy-sequence file-alist) ; modifies its argument!
(cond ((memq ?S switches)
(lambda (x y) ; sorted on size
- ;; 7th file attribute is file size
;; Make largest file come first
- (< (nth 7 (cdr y))
- (nth 7 (cdr x)))))
+ (< (file-attribute-size (cdr y))
+ (file-attribute-size (cdr x)))))
((setq index (ls-lisp-time-index switches))
(lambda (x y) ; sorted on time
(time-less-p (nth index (cdr y))
The file type indicators are `/' for directories, `@' for symbolic
links, `|' for FIFOs, `=' for sockets, `*' for regular files that
are executable, and nothing for other types of files."
- (let* ((type (car fattr))
- (modestr (nth 8 fattr))
+ (let* ((type (file-attribute-type fattr))
+ (modestr (file-attribute-modes fattr))
(typestr (substring modestr 0 1))
(file-name (propertize filename 'dired-filename t)))
(cond
"Format one line of long ls output for file FILE-NAME.
FILE-ATTR and FILE-SIZE give the file's attributes and size.
SWITCHES and TIME-INDEX give the full switch list and time data."
- (let ((file-type (nth 0 file-attr))
+ (let ((file-type (file-attribute-type file-attr))
;; t for directory, string (name linked to)
;; for symbolic link, or nil.
- (drwxrwxrwx (nth 8 file-attr))) ; attribute string ("drwxrwxrwx")
+ (drwxrwxrwx (file-attribute-modes file-attr)))
(concat (if (memq ?i switches) ; inode number
- (let ((inode (nth 10 file-attr)))
- (if (consp inode)
- (if (consp (cdr inode))
- ;; 2^(24+16) = 1099511627776.0, but
- ;; multiplying by it and then adding the
- ;; other members of the cons cell in one go
- ;; loses precision, since a double does not
- ;; have enough significant digits to hold a
- ;; full 64-bit value. So below we split
- ;; 1099511627776 into high 13 and low 5
- ;; digits and compute in two parts.
- (let ((p1 (* (car inode) 10995116.0))
- (p2 (+ (* (car inode) 27776.0)
- (* (cadr inode) 65536.0)
- (cddr inode))))
- (format " %13.0f%05.0f "
- ;; Use floor to emulate integer
- ;; division.
- (+ p1 (floor p2 100000.0))
- (mod p2 100000.0)))
- (format " %18.0f "
- (+ (* (car inode) 65536.0)
- (cdr inode))))
- (format " %18d " inode))))
+ (let ((inode (file-attribute-inode-number file-attr)))
+ (format " %18d " inode)))
;; nil is treated like "" in concat
(if (memq ?s switches) ; size in K, rounded up
;; In GNU ls, -h affects the size in blocks, displayed
(fceiling (/ file-size 1024.0)))))
drwxrwxrwx ; attribute string
(if (memq 'links ls-lisp-verbosity)
- (format "%3d" (nth 1 file-attr))) ; link count
+ (format "%3d" (file-attribute-link-number file-attr)))
;; Numeric uid/gid are more confusing than helpful;
;; Emacs should be able to make strings of them.
;; They tend to be bogus on non-UNIX platforms anyway so
;; optionally hide them.
(if (memq 'uid ls-lisp-verbosity)
;; uid can be a string or an integer
- (let ((uid (nth 2 file-attr)))
+ (let ((uid (file-attribute-user-id file-attr)))
(format (if (stringp uid)
ls-lisp-uid-s-fmt
ls-lisp-uid-d-fmt)
(if (not (memq ?G switches)) ; GNU ls -- shows group by default
(if (or (memq ?g switches) ; UNIX ls -- no group by default
(memq 'gid ls-lisp-verbosity))
- (let ((gid (nth 3 file-attr)))
+ (let ((gid (file-attribute-group-id file-attr)))
(format (if (stringp gid)
ls-lisp-gid-s-fmt
ls-lisp-gid-d-fmt)
(setq attr (file-attributes dirname))
(if (not (eq t (car attr)))
(insert (format "echo %s is not a directory\n" rmail-spool-directory))
- (setq modes (nth 8 attr))
+ (setq modes (file-attribute-modes attr))
(cond ((= ?w (aref modes 8))
;; Nothing needs to be done.
)
((= ?w (aref modes 5))
- (insert "chgrp " (number-to-string (nth 3 attr))
+ (insert "chgrp " (number-to-string (file-attribute-group-id attr))
" $* && chmod g+s $*\n"))
((= ?w (aref modes 2))
- (insert "chown " (number-to-string (nth 2 attr))
+ (insert "chown " (number-to-string (file-attribute-user-id attr))
" $* && chmod u+s $*\n"))
(t
(insert "chown root $* && chmod u+s $*\n"))))
(defun feedmail-default-date-generator (maybe-file)
"Default function for generating Date: header contents."
(feedmail-say-debug ">in-> feedmail-default-date-generator")
- (when maybe-file
- (feedmail-say-debug (concat "4 cre " (feedmail-rfc822-date (nth 4 (file-attributes maybe-file)))))
- (feedmail-say-debug (concat "5 mod " (feedmail-rfc822-date (nth 5 (file-attributes maybe-file)))))
- (feedmail-say-debug (concat "6 sta " (feedmail-rfc822-date (nth 6 (file-attributes maybe-file))))))
- (let ((date-time))
- (if (and (not feedmail-queue-use-send-time-for-date) maybe-file)
- (setq date-time (nth 5 (file-attributes maybe-file))))
- (feedmail-rfc822-date date-time))
- )
-
+ (let ((attr (and maybe-file (file-attributes maybe-file))))
+ (when attr
+ (feedmail-say-debug (concat "4 cre " (feedmail-rfc822-date (file-attribute-access-time attr))))
+ (feedmail-say-debug (concat "5 mod " (feedmail-rfc822-date (file-attribute-modification-time attr))))
+ (feedmail-say-debug (concat "6 sta " (feedmail-rfc822-date (file-attribute-status-change-time attr)))))
+ (feedmail-rfc822-date (and attr (not feedmail-queue-use-send-time-for-date)
+ (file-attribute-modification-time attr)))))
(defun feedmail-fiddle-date (maybe-file)
"Fiddle Date:. See documentation of `feedmail-date-generator'."
(concat (if (equal (match-beginning 1) (match-end 1)) "" "-") end-stuff))
(setq end-stuff (concat "@" end-stuff)))
(if (and (not feedmail-queue-use-send-time-for-message-id) maybe-file)
- (setq date-time (nth 5 (file-attributes maybe-file))))
+ (setq date-time (file-attribute-modification-time
+ (file-attributes maybe-file))))
(format "<%d-%s%s%s>"
(mod (random) 10000)
(format-time-string "%a%d%b%Y%H%M%S" date-time)
(defun mail-abbrevs-sync-aliases ()
(when mail-personal-alias-file
(if (file-exists-p mail-personal-alias-file)
- (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
+ (let ((modtime (file-attribute-modification-time
+ (file-attributes mail-personal-alias-file))))
(if (not (equal mail-abbrev-modtime modtime))
(progn
(setq mail-abbrev-modtime modtime)
(file-exists-p mail-personal-alias-file))
(progn
(setq mail-abbrev-modtime
- (nth 5 (file-attributes mail-personal-alias-file)))
+ (file-attribute-modification-time
+ (file-attributes mail-personal-alias-file)))
(build-mail-abbrevs)))
(mail-abbrevs-sync-aliases)
(add-function :around (local 'abbrev-expand-function)
(let ((file (concat mspools-folder-directory spool))
size)
(setq file (or (file-symlink-p file) file))
- (setq size (nth 7 (file-attributes file)))
+ (setq size (file-attribute-size (file-attributes file)))
;; size could be nil if the sym-link points to a non-existent file
;; so check this first.
(if (and size (> size 0))
"the remote server"
proto)))
((and (file-exists-p tofile)
- (/= 0 (nth 7 (file-attributes tofile))))
+ (/= 0 (file-attribute-size (file-attributes tofile))))
(message "Getting mail from %s..." tofile))
((and (file-exists-p file)
- (/= 0 (nth 7 (file-attributes file))))
+ (/= 0 (file-attribute-size (file-attributes file))))
(message "Getting mail from %s..." file)))
;; Set TOFILE if have not already done so, and
;; rename or copy the file FILE to TOFILE if and as appropriate.
\f
(defun sendmail-sync-aliases ()
(when mail-personal-alias-file
- (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
+ (let ((modtime (file-attribute-modification-time
+ (file-attributes mail-personal-alias-file))))
(or (equal mail-alias-modtime modtime)
(setq mail-alias-modtime modtime
mail-aliases t)))))
(function
(lambda (file)
(when (and file (file-exists-p file))
- (setq stamp (nth 5 (file-attributes file)))
+ (setq stamp (file-attribute-modification-time
+ (file-attributes file)))
(or (> (car stamp) (car mh-alias-tstamp))
(and (= (car stamp) (car mh-alias-tstamp))
(> (cadr stamp) (cadr mh-alias-tstamp)))))))
(ange-ftp-real-expand-file-name ange-ftp-netrc-filename)))
(setq attr (ange-ftp-real-file-attributes file)))
(if (and attr ; file exists.
- (not (equal (nth 5 attr) ange-ftp-netrc-modtime))) ; file changed
+ (not (equal (file-attribute-modification-time attr)
+ ange-ftp-netrc-modtime))) ; file changed
(save-match-data
(if (or ange-ftp-disable-netrc-security-check
- (and (eq (nth 2 attr) (user-uid)) ; Same uids.
- (string-match ".r..------" (nth 8 attr))))
+ (and (eq (file-attribute-user-id attr) (user-uid)) ; Same uids.
+ (string-match ".r..------"
+ (file-attribute-modes attr))))
(with-current-buffer
;; we are cheating a bit here. I'm trying to do the equivalent
;; of find-file on the .netrc file, but then nuke it afterwards.
(ange-ftp-message "%s either not owned by you or badly protected."
ange-ftp-netrc-filename)
(sit-for 1))
- (setq ange-ftp-netrc-modtime (nth 5 attr))))))
+ (setq ange-ftp-netrc-modtime
+ (file-attribute-modification-time attr))))))
;; Return a list of prefixes of the form 'user@host:' to be used when
;; completion is done in the root directory.
;; tell the process filter what size the transfer will be.
(let ((attr (file-attributes temp)))
(if attr
- (ange-ftp-set-xfer-size host user (nth 7 attr))))
+ (ange-ftp-set-xfer-size host user
+ (file-attribute-size attr))))
;; put or append the file.
(let ((result (ange-ftp-send-cmd host user
(let ((f1-parsed (ange-ftp-ftp-name f1))
(f2-parsed (ange-ftp-ftp-name f2)))
(if (or f1-parsed f2-parsed)
- (let ((f1-mt (nth 5 (file-attributes f1)))
- (f2-mt (nth 5 (file-attributes f2))))
+ (let ((f1-mt (file-attribute-modification-time (file-attributes f1)))
+ (f2-mt (file-attribute-modification-time (file-attributes f2))))
(cond ((null f1-mt) nil)
((null f2-mt) t)
(t (time-less-p f2-mt f1-mt))))
;; tell the process filter what size the file is.
(let ((attr (file-attributes (or temp2 filename))))
(if attr
- (ange-ftp-set-xfer-size t-host t-user (nth 7 attr))))
+ (ange-ftp-set-xfer-size t-host t-user
+ (file-attribute-size attr))))
(ange-ftp-send-cmd
t-host
(let ((fmt-string "%ln:%fn:%p:%e")
(mab-buffer (get-buffer-create " *mab contacts*"))
- (modified (nth 5 (file-attributes eudc-contacts-file)))
+ (modified (file-attribute-modification-time
+ (file-attributes eudc-contacts-file)))
result)
(with-current-buffer mab-buffer
(make-local-variable 'eudc-buffer-time)
(defun eww-read-bookmarks ()
(let ((file (expand-file-name "eww-bookmarks" eww-bookmarks-directory)))
(setq eww-bookmarks
- (unless (zerop (or (nth 7 (file-attributes file)) 0))
+ (unless (zerop (or (file-attribute-size (file-attributes file)) 0))
(with-temp-buffer
(insert-file-contents file)
(read (current-buffer)))))))
"port"))
alist elem result pair)
(if (and netrc-cache
- (equal (car netrc-cache) (nth 5 (file-attributes file))))
+ (equal (car netrc-cache) (file-attribute-modification-time
+ (file-attributes file))))
(insert (base64-decode-string (rot13-string (cdr netrc-cache))))
(insert-file-contents file)
(when (string-match "\\.gpg\\'" file)
;; Store the contents of the file heavily encrypted in memory.
- (setq netrc-cache (cons (nth 5 (file-attributes file))
+ (setq netrc-cache (cons (file-attribute-modification-time
+ (file-attributes file))
(rot13-string
(base64-encode-string
(buffer-string)))))))
(let ((image-name (concat directory feed-name)))
(if (and (file-exists-p image-name)
(time-less-p nil
- (time-add (nth 5 (file-attributes image-name))
+ (time-add (file-attribute-modification-time
+ (file-attributes image-name))
(seconds-to-time 86400))))
(newsticker--debug-msg "%s: Getting image for %s skipped"
(format-time-string "%A, %H:%M")
(defsubst tramp-compat-file-attribute-modification-time (attributes)
"The modification time in ATTRIBUTES returned by `file-attributes'.
This is the time of the last change to the file's contents, and
-is a list of integers (HIGH LOW USEC PSEC) in the same style
-as (current-time)."
+is a Lisp timestamp in the style of `current-time'."
(nth 5 attributes)))
(if (fboundp 'file-attribute-size)
(defalias 'tramp-compat-file-attribute-size 'file-attribute-size)
(defsubst tramp-compat-file-attribute-size (attributes)
"The size (in bytes) in ATTRIBUTES returned by `file-attributes'.
-This is a floating point number if the size is too large for an integer."
+If the size is too large for a fixnum, this is a bignum in Emacs 27
+and later, and is a float in Emacs 26 and earlier."
(nth 7 attributes)))
(if (fboundp 'file-attribute-modes)
"Return a list of rules for the schema locating file FILE."
(setq file (expand-file-name file))
(let ((cached (assoc file rng-schema-locating-file-alist))
- (mtime (nth 5 (file-attributes file)))
+ (mtime (file-attribute-modification-time (file-attributes file)))
parsed)
(cond ((not mtime)
(when cached
;; Only save if user's restrictions are satisfied.
(and min-size (>= (buffer-size) min-size))
(or fast-lock-save-others
- (eq (user-uid) (nth 2 (file-attributes buffer-file-name))))
+ (eq (user-uid) (file-attribute-user-id
+ (file-attributes buffer-file-name))))
;;
;; Only save if there are `face' properties to save.
(text-property-not-all (point-min) (point-max) 'face nil))
;; Buh? Unexpected format.
'edited
(let ((ats (file-attributes file)))
- (if (and (eq (nth 7 ats) (string-to-number (match-string 2)))
- (equal (format-time-string "%s" (nth 5 ats))
+ (if (and (eq (file-attribute-size ats) (string-to-number (match-string 2)))
+ (equal (format-time-string
+ "%s" (file-attribute-modification-time ats))
(match-string 1)))
'up-to-date
'edited)))))))))
(defun vc-arch-diff3-rej-p (rej)
(let ((attrs (file-attributes rej)))
- (and attrs (< (nth 7 attrs) 60)
+ (and attrs (< (file-attribute-size attrs) 60)
(with-temp-buffer
(insert-file-contents rej)
(goto-char (point-min))
(delete-file input-file))
(when (and error-file (file-exists-p error-file))
- (when (< 0 (nth 7 (file-attributes error-file)))
+ (when (< 0 (file-attribute-size (file-attributes error-file)))
(with-current-buffer (get-buffer-create error-buffer)
(let ((pos-from-end (- (point-max) (point))))
(or (bobp)
(shell-command-to-string
"git ls-files -zmo --exclude-standard") "\0" t))
(if (and use-annex
- (>= (nth 7 (file-attributes new-or-modified))
+ (>= (file-attribute-size (file-attributes new-or-modified))
org-attach-git-annex-cutoff))
(call-process "git" nil nil nil "annex" "add" new-or-modified)
(call-process "git" nil nil nil "add" new-or-modified))
(format "(eval (format-time-string \"$1\" (or (and (org-string-nw-p \"$2\") (org-macro--vc-modified-time %s)) '%s)))"
(prin1-to-string visited-file)
(prin1-to-string
- (nth 5 (file-attributes visited-file)))))))))
+ (file-attribute-modification-time
+ (file-attributes visited-file)))))))))
;; Initialize and install "n" macro.
(org-macro--counter-initialize)
(funcall update-templates
(let* ((age (lambda (file)
(float-time
(time-subtract (current-time)
- (nth 5 (or (file-attributes (file-truename file))
- (file-attributes file)))))))
+ (file-attribute-modification-time
+ (or (file-attributes (file-truename file))
+ (file-attributes file)))))))
(base-name (file-name-sans-extension file))
(exported-file (concat base-name ".el")))
;; tangle if the Org file is newer than the elisp file
;; (e.g. HFS+) do not retain any finer granularity. As
;; a consequence, make sure we return non-nil when the two
;; times are equal.
- (not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2)
+ (not (time-less-p (cl-subseq (file-attribute-modification-time
+ (file-attributes file))
+ 0 2)
(cl-subseq time 0 2)))))
(defun org-compile-file (source process ext &optional err-msg log-buf spec)
(?c . ,(plist-get info :creator))
(?C . ,(let ((file (plist-get info :input-file)))
(format-time-string timestamp-format
- (and file (nth 5 (file-attributes file))))))
+ (and file (file-attribute-modification-time
+ (file-attributes file))))))
(?v . ,(or (plist-get info :html-validation-link) "")))))
(defun org-html--build-pre/postamble (type info)
any other case use the file system's modification time. Return
time in `current-time' format."
(let ((file (org-publish--expand-file-name file project)))
- (if (file-directory-p file) (nth 5 (file-attributes file))
+ (if (file-directory-p file) (file-attribute-modification-time
+ (file-attributes file))
(let ((date (org-publish-find-property file :date project)))
;; DATE is a secondary string. If it contains a time-stamp,
;; convert it to internal format. Otherwise, use FILE
(let ((value (org-element-interpret-data ts)))
(and (org-string-nw-p value)
(org-time-string-to-time value))))))
- ((file-exists-p file) (nth 5 (file-attributes file)))
+ ((file-exists-p file) (file-attribute-modification-time
+ (file-attributes file)))
(t (error "No such file: \"%s\"" file)))))))
(defun org-publish-sitemap-default-entry (entry style project)
(expand-file-name (or (file-symlink-p file) file)
(file-name-directory file)))))
(if (not attr) (error "No such file: \"%s\"" file)
- (+ (ash (car (nth 5 attr)) 16)
- (cadr (nth 5 attr))))))
+ (floor (float-time (file-attribute-modification-time attr))))))
(provide 'ox-publish)
(while (pcomplete-here
(if (and complete-within
(let* ((fa (file-attributes (pcomplete-arg 1)))
- (size (nth 7 fa)))
+ (size (file-attribute-size fa)))
(and (numberp size)
(or (null large-file-warning-threshold)
(< size large-file-warning-threshold)))))
"Return a list of all installed rpm packages."
(if (and pcmpl-rpm-cache
pcmpl-rpm-cache-time
- (let ((mtime (nth 5 (file-attributes pcmpl-rpm-cache-stamp-file))))
+ (let ((mtime (file-attribute-modification-time
+ (file-attributes pcmpl-rpm-cache-stamp-file))))
(and mtime (not (time-less-p pcmpl-rpm-cache-time mtime)))))
pcmpl-rpm-packages
(message "Getting list of installed rpms...")
(setq phrase-file (cookie-check-file phrase-file))
(let ((sym (intern-soft phrase-file cookie-cache)))
(and sym (not (equal (symbol-function sym)
- (nth 5 (file-attributes phrase-file))))
+ (file-attribute-modification-time
+ (file-attributes phrase-file))))
(yes-or-no-p (concat phrase-file
" has changed. Read new contents? "))
(setq sym nil))
(symbol-value sym)
(setq sym (intern phrase-file cookie-cache))
(if startmsg (message "%s" startmsg))
- (fset sym (nth 5 (file-attributes phrase-file)))
+ (fset sym (file-attribute-modification-time
+ (file-attributes phrase-file)))
(let (result)
(with-temp-buffer
(insert-file-contents (expand-file-name phrase-file))
(not (member (file-name-nondirectory shell-file-name)
msdos-shells)))
(eq exit-status 0))
- (zerop (nth 7 (file-attributes (expand-file-name tempname))))
+ (zerop (file-attribute-size
+ (file-attributes (expand-file-name tempname))))
(progn
(goto-char (point-min))
;; Put the messages inside a comment, so they won't get in
(defsubst bdf-file-mod-time (filename)
"Return modification time of FILENAME.
-The value is a list of integers in the same format as `current-time'."
- (nth 5 (file-attributes filename)))
+The value is a timestamp in the same format as `current-time'."
+ (file-attribute-modification-time (file-attributes filename)))
(defun bdf-file-newer-than-time (filename mod-time)
"Return non-nil if and only if FILENAME is newer than MOD-TIME.
-MOD-TIME is a modification time as a list of integers in the same
-format as `current-time'."
+MOD-TIME is a modification time in the same format as `current-time'."
(let ((new-mod-time (bdf-file-mod-time filename)))
(time-less-p mod-time new-mod-time)))
(BDFFILE MOD-TIME FONT-BOUNDING-BOX
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
-MOD-TIME is last modification time as a list of integers in the
-same format as `current-time'.
+MOD-TIME is last modification time in the same format as `current-time'.
SIZE is a size of the font on 72 dpi device. This value is got
from SIZE record of the font.
(setq attrs (file-attributes dir 'integer)))
;; Check that it's safe for use.
- (let* ((uid (nth 2 attrs))
+ (let* ((uid (file-attribute-user-id attrs))
(w32 (eq system-type 'windows-nt))
(unsafe (cond
- ((not (eq t (car attrs)))
+ ((not (eq t (file-attribute-type attrs)))
(if (null attrs) "its attributes can't be checked"
(format "it is a %s"
- (if (stringp (car attrs))
+ (if (stringp (file-attribute-type attrs))
"symlink" "file"))))
((and w32 (zerop uid)) ; on FAT32?
(display-warning
;; No output; error?
(let ((output
(if (and error-file
- (< 0 (nth 7 (file-attributes error-file))))
+ (< 0 (file-attribute-size
+ (file-attributes error-file))))
(format "some error output%s"
(if shell-command-default-error-buffer
(format " to the \"%s\" buffer"
)))))
(when (and error-file (file-exists-p error-file))
- (if (< 0 (nth 7 (file-attributes error-file)))
+ (if (< 0 (file-attribute-size (file-attributes error-file)))
(with-current-buffer (get-buffer-create error-buffer)
(let ((pos-from-end (- (point-max) (point))))
(or (bobp)
instead of reading it from the speedbar buffer."
(let* ((item (or filename (speedbar-line-file)))
(attr (if item (file-attributes item) nil)))
- (if (and item attr) (dframe-message "%s %-6d %s" (nth 8 attr)
- (nth 7 attr) item)
- nil)))
+ (if (and item attr)
+ (dframe-message "%s %-6d %s"
+ (file-attribute-modes attr)
+ (file-attribute-size attr) item))))
(defun speedbar-item-info-tag-helper ()
"Display info about a tag that is on the current line.
(cdr (car oa))))))
nil
;; Find out if the object is out of date or not.
- (let ((date1 (nth 5 (file-attributes fulln)))
- (date2 (nth 5 (file-attributes (concat
- (file-name-sans-extension fulln)
- (cdr (car oa)))))))
- (if (or (< (car date1) (car date2))
- (and (= (car date1) (car date2))
- (< (nth 1 date1) (nth 1 date2))))
+ (let ((date1 (file-attribute-modification-time
+ (file-attributes fulln)))
+ (date2 (file-attribute-modification-time
+ (file-attributes (concat
+ (file-name-sans-extension fulln)
+ (cdr (car oa)))))))
+ (if (time-less-p date1 date2)
(car speedbar-obj-indicator)
(cdr speedbar-obj-indicator)))))))
\f
(mapcar
(lambda (f)
(let ((fattribs-list (file-attributes f)))
- `(,(nth 4 fattribs-list) ,(nth 7 fattribs-list) ,f)))
+ `(,(file-attribute-access-time fattribs-list)
+ ,(file-attribute-size fattribs-list)
+ ,f)))
(directory-files (thumbs-thumbsdir) t (image-file-name-regexp)))
(lambda (l1 l2) (time-less-p (car l1) (car l2)))))
(dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files-list))))
(while (and mail-files (= size 0))
;; Count size of regular files only.
(setq size (+ size (or (and (file-regular-p (car mail-files))
- (nth 7 (file-attributes (car mail-files))))
+ (file-attribute-size
+ (file-attributes (car mail-files))))
0)))
(setq mail-files (cdr mail-files)))
(if (> size 0)
(defun display-time-file-nonempty-p (file)
(let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
(and (file-exists-p file)
- (< 0 (nth 7 (file-attributes (file-chase-links file)))))))
+ (< 0 (file-attribute-size
+ (file-attributes (file-chase-links file)))))))
;;;###autoload
(define-minor-mode display-time-mode
The actual return value is the last modification time of the cache file."
(let* ((fname (url-cache-create-filename url))
(attribs (file-attributes fname)))
- (and fname ; got a filename
- (file-exists-p fname) ; file exists
- (not (eq (nth 0 attribs) t)) ; Its not a directory
- (nth 5 attribs)))) ; Can get last mod-time
+ (and fname
+ (file-exists-p fname)
+ (not (eq (file-attribute-type attribs) t))
+ (file-attribute-modification-time attribs))))
(defun url-cache-create-filename-human-readable (url)
"Return a filename in the local cache for URL."
(setq deleted-files (1+ deleted-files))))
((time-less-p
(time-add
- (nth 5 (file-attributes file))
+ (file-attribute-modification-time (file-attributes file))
(seconds-to-time url-cache-expire-time))
now)
(delete-file file)
buff func
func args
args efs))
- (let ((size (nth 7 (file-attributes name))))
+ (let ((size (file-attribute-size (file-attributes name))))
(with-current-buffer buff
(goto-char (point-max))
(if (/= -1 size)
;; can just remove the file altogether. Very handy for .rej files if we
;; remove hunks as we apply them.
(when (and buffer-file-name
- (eq 0 (nth 7 (file-attributes buffer-file-name))))
+ (eq 0 (file-attribute-size (file-attributes buffer-file-name))))
(delete-file buffer-file-name)))
(defun diff-delete-empty-files ()
((not (file-exists-p (concat dir f))) (setq type 'MISSING))
((equal rev "0") (setq type 'ADDED rev nil))
((equal date "Result of merge") (setq subtype 'MERGED))
- ((let ((mtime (nth 5 (file-attributes (concat dir f))))
+ ((let ((mtime (file-attribute-modification-time
+ (file-attributes (concat dir f))))
(system-time-locale "C"))
(setq timestamp (format-time-string "%c" mtime t))
;; Solaris sometimes uses "Wed Sep 05", not "Wed Sep 5".
;; If file is in dirstate, can only be added (b#8025).
((or (not (match-beginning 4))
(eq (char-after (match-beginning 4)) ?a)) 'added)
- ((or (and (eq (string-to-number (match-string 3))
- (nth 7 (file-attributes file)))
+ ((or (and (eql (string-to-number (match-string 3))
+ (file-attribute-size (file-attributes file)))
(equal (match-string 5)
(save-match-data (vc-bzr-sha1 file)))
;; For a file, does the executable state match?
?x
(mapcar
'identity
- (nth 8 (file-attributes file))))))
+ (file-attribute-modes
+ (file-attributes file))))))
(if (eq (char-after (match-beginning 7))
?y)
exe
;; checkouts \2 is empty and we need to
;; look for size in \6.
(eq (match-beginning 2) (match-end 2))
- (eq (string-to-number (match-string 6))
- (nth 7 (file-attributes file)))
+ (eql (string-to-number (match-string 6))
+ (file-attribute-size (file-attributes file)))
(equal (match-string 5)
(vc-bzr-sha1 file))))
'up-to-date)
;; (We actually shouldn't trust this, but there is
;; no other way to learn this from CVS at the
;; moment (version 1.9).)
- (string-match "r-..-..-." (nth 8 attrib)))
+ (string-match "r-..-..-." (file-attribute-modes attrib)))
'announce
'implicit))))))
;; If the file has not changed since checkout, consider it `up-to-date'.
;; Otherwise consider it `edited'.
(let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
- (lastmod (nth 5 (file-attributes file))))
+ (lastmod (file-attribute-modification-time (file-attributes file))))
(cond
((equal checkout-time lastmod) 'up-to-date)
((string= (vc-working-revision file) "0") 'added)
(string= (match-string 1) "P "))
(vc-file-setprop file 'vc-state 'up-to-date)
(vc-file-setprop file 'vc-checkout-time
- (nth 5 (file-attributes file)))
+ (file-attribute-modification-time
+ (file-attributes file)))
0);; indicate success to the caller
;; Merge successful, but our own changes are still in the file
((string= (match-string 1) "M ")
(vc-file-setprop file 'vc-state 'up-to-date)
(vc-file-setprop file 'vc-working-revision nil)
(vc-file-setprop file 'vc-checkout-time
- (nth 5 (file-attributes file))))
+ (file-attribute-modification-time
+ (file-attributes file))))
((or (string= state "M")
(string= state "C"))
(vc-file-setprop file 'vc-state 'edited)
(cond
((string-match "Up-to-date" status)
(vc-file-setprop file 'vc-checkout-time
- (nth 5 (file-attributes file)))
+ (file-attribute-modification-time
+ (file-attributes file)))
'up-to-date)
((string-match "Locally Modified" status) 'edited)
((string-match "Needs Merge" status) 'needs-merge)
;; (which is based on textual comparison), because there can be problems
;; generating a time string that looks exactly like the one from CVS.
(let* ((time (match-string 2))
- (mtime (nth 5 (file-attributes file)))
+ (mtime (file-attribute-modification-time (file-attributes file)))
(parsed-time (progn (require 'parse-time)
(parse-time-string (concat time " +0000")))))
(cond ((and (not (string-match "\\+" time))
(with-temp-buffer
(let ((attr (file-attributes hgignore)))
(when attr (insert-file-contents hgignore))
- (push (list hgignore (nth 5 attr) (nth 7 attr))
+ (push (list hgignore (file-attribute-modification-time attr) (file-attribute-size attr))
vc-hg--hgignore-filenames))
(while (not (eobp))
;; This list of pattern-file commands isn't complete, but it
(saved-mtime (nth 1 fs))
(saved-size (nth 2 fs))
(attr (file-attributes (nth 0 fs)))
- (current-mtime (nth 5 attr))
- (current-size (nth 7 attr)))
+ (current-mtime (file-attribute-modification-time attr))
+ (current-size (file-attribute-size attr)))
(unless (and (equal saved-mtime current-mtime)
(equal saved-size current-size))
(setf valid nil))))
`vc-hg-state', as we see during registration queries.")
(defun vc-hg--cached-dirstate-search (dirstate dirstate-attr ascii-fname)
- (let* ((mtime (nth 5 dirstate-attr))
- (size (nth 7 dirstate-attr))
+ (let* ((mtime (file-attribute-modification-time dirstate-attr))
+ (size (file-attribute-size dirstate-attr))
(cache vc-hg--dirstate-scan-cache)
)
(if (and cache
;; Repository must be in an understood format
(not (vc-hg--requirements-understood-p repo))
;; Dirstate too small to be valid
- (< (nth 7 dirstate-attr) 40)
+ (< (file-attribute-size dirstate-attr) 40)
(progn
(setf repo-relative-filename
(file-relative-name truename repo))
((eq state ?n)
(let ((vc-hg-size (nth 2 dirstate-entry))
(vc-hg-mtime (nth 3 dirstate-entry))
- (fs-size (nth 7 stat))
- (fs-mtime (vc-hg--time-to-integer (nth 5 stat))))
+ (fs-size (file-attribute-size stat))
+ (fs-mtime (vc-hg--time-to-integer
+ (file-attribute-modification-time stat))))
(if (and (eql vc-hg-size fs-size) (eql vc-hg-mtime fs-mtime))
'up-to-date
'edited)))
;; If the file was saved in the same second in which it was
;; checked out, clear the checkout-time to avoid confusion.
(if (equal (vc-file-getprop file 'vc-checkout-time)
- (nth 5 (file-attributes file)))
+ (file-attribute-modification-time (file-attributes file)))
(vc-file-setprop file 'vc-checkout-time nil))
(if (vc-state-refresh file backend)
(vc-mode-line file backend)))
"Return non-nil if FILE is newer than its RCS master.
This likely means that FILE has been changed with respect
to its master version."
- (let ((file-time (nth 5 (file-attributes file)))
- (master-time (nth 5 (file-attributes (vc-master-name file)))))
- (or (> (nth 0 file-time) (nth 0 master-time))
- (and (= (nth 0 file-time) (nth 0 master-time))
- (> (nth 1 file-time) (nth 1 master-time))))))
+ (let ((file-time (file-attribute-modification-time (file-attributes file)))
+ (master-time (file-attribute-modification-time
+ (file-attributes (vc-master-name file)))))
+ (time-less-p master-time file-time)))
(defun vc-rcs-find-most-recent-rev (branch)
"Find most recent revision on BRANCH."
((string= (match-string 2) "U")
(vc-file-setprop file 'vc-state 'up-to-date)
(vc-file-setprop file 'vc-checkout-time
- (nth 5 (file-attributes file)))
+ (file-attribute-modification-time
+ (file-attributes file)))
0);; indicate success to the caller
;; Merge successful, but our own changes are still in the file
((string= (match-string 2) "G")
(if (eq (char-after (match-beginning 1)) ?*)
'needs-update
(vc-file-setprop file 'vc-checkout-time
- (nth 5 (file-attributes file)))
+ (file-attribute-modification-time
+ (file-attributes file)))
'up-to-date))
((eq status ?A)
;; If the file was actually copied, (match-string 2) is "-".
nil)
'up-to-date
'edited))
- (vc-checkout-time . ,(nth 5 (file-attributes file))))))
+ (vc-checkout-time . ,(file-attribute-modification-time
+ (file-attributes file))))))
(vc-resynch-buffer file t t)
(run-hooks 'vc-checkout-hook))
(vc-call-backend backend 'checkin files comment rev)
(mapc 'vc-delete-automatic-version-backups files))
`((vc-state . up-to-date)
- (vc-checkout-time . ,(nth 5 (file-attributes file)))
+ (vc-checkout-time . ,(file-attribute-modification-time
+ (file-attributes file)))
(vc-working-revision . nil)))
(message "Checking in %s...done" (vc-delistify files)))
'vc-checkin-hook
(vc-delete-automatic-version-backups file))
(vc-call revert file backup-file))
`((vc-state . up-to-date)
- (vc-checkout-time . ,(nth 5 (file-attributes file)))))
+ (vc-checkout-time . ,(file-attribute-modification-time
+ (file-attributes file)))))
(vc-resynch-buffer file t t))
;;;###autoload
(files ()))
(let ((mtim1 (get 'xdg-mime-table 'mtime))
(mtim2 (cl-loop for f in caches when (file-readable-p f)
- maximize (float-time (nth 5 (file-attributes f))))))
+ maximize (float-time
+ (file-attribute-modification-time
+ (file-attributes f))))))
;; If one of the MIME/Desktop cache files has been modified:
(when (or (null mtim1) (time-less-p mtim1 mtim2))
(setq xdg-mime-table nil)))
from (abs POSITION). If POSITION is positive, point was at the front
of the text being deleted; if negative, point was at the end.
-An entry (t HIGH LOW USEC PSEC) indicates that the buffer was previously
-unmodified; (HIGH LOW USEC PSEC) is in the same style as (current-time)
-and is the visited file's modification time, as of that time. If the
-modification time of the most recent save is different, this entry is
-obsolete.
+An entry (t . TIMESTAMP), where TIMESTAMP is in the style of
+`current-time', indicates that the buffer was previously unmodified;
+TIMESTAMP is the visited file's modification time, as of that time.
+If the modification time of the most recent save is different, this
+entry is obsolete.
An entry (t . 0) means the buffer was previously unmodified but
its time stamp was unknown because it was not associated with a file.
doc: /* Return a list of names of files and their attributes in DIRECTORY.
Value is a list of the form:
- ((FILE1 FILE1-ATTRS) (FILE2 FILE2-ATTRS) ...)
+ ((FILE1 . FILE1-ATTRS) (FILE2 . FILE2-ATTRS) ...)
where each FILEn-ATTRS is the attributes of FILEn as returned
by `file-attributes'.
Elements of the attribute list are:
0. t for directory, string (name linked to) for symbolic link, or nil.
1. Number of links to file.
- 2. File uid as a string or a number. If a string value cannot be
- looked up, an integer value is returned, which could be a fixnum,
- if it's small enough, otherwise a bignum.
+ 2. File uid as a string or (if ID-FORMAT is `integer' or a string value
+ cannot be looked up) as an integer.
3. File gid, likewise.
- 4. Last access time, as a list of integers (HIGH LOW USEC PSEC) in the
- same style as (current-time).
+ 4. Last access time, in the style of `current-time'.
(See a note below about access time on FAT-based filesystems.)
5. Last modification time, likewise. This is the time of the last
change to the file's contents.
6. Last status change time, likewise. This is the time of last change
to the file's attributes: owner and group, access mode bits, etc.
- 7. Size in bytes, which could be a fixnum, if it's small enough,
- otherwise a bignum.
+ 7. Size in bytes, as an integer.
8. File modes, as a string of ten letters or dashes as in ls -l.
9. An unspecified value, present only for backward compatibility.
-10. inode number, which could be a fixnum, if it's small enough,
- otherwise a bignum.
-11. Filesystem device number. If it is larger than what a fixnum
- can hold, it is a bignum.
+10. inode number, as a nonnegative integer.
+11. Filesystem device number, as an integer.
+Large integers are bignums, so `eq' might not work on them.
On most filesystems, the combination of the inode and the device
number uniquely identifies the file.
DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time,
0, 0, 0,
doc: /* Return the current run time used by Emacs.
-The time is returned as a list (HIGH LOW USEC PSEC), using the same
-style as (current-time).
+The time is returned as in the style of `current-time'.
On systems that can't determine the run time, `get-internal-run-time'
does the same thing as `current-time'. */)
DEFUN ("visited-file-modtime", Fvisited_file_modtime,
Svisited_file_modtime, 0, 0, 0,
doc: /* Return the current buffer's recorded visited file modification time.
-The value is a list of the form (HIGH LOW USEC PSEC), like the time values that
-`file-attributes' returns. If the current buffer has no recorded file
-modification time, this function returns 0. If the visited file
-doesn't exist, return -1.
+Return a Lisp timestamp (as in `current-time') if the current buffer
+has a recorded file modification time, 0 if it doesn't, and -1 if the
+visited file doesn't exist.
See Info node `(elisp)Modification Time' for more details. */)
(void)
{
Useful if the buffer was not read from the file normally
or if the file itself has been changed for some known benign reason.
An argument specifies the modification time value to use
-\(instead of that of the visited file), in the form of a list
-\(HIGH LOW USEC PSEC) or an integer flag as returned by
-`visited-file-modtime'. */)
+\(instead of that of the visited file), in the form of a time value as
+in `current-time' or an integer flag as returned by `visited-file-modtime'. */)
(Lisp_Object time_flag)
{
if (!NILP (time_flag))
DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0,
doc: /* Return the current length of Emacs idleness, or nil.
-The value when Emacs is idle is a list of four integers (HIGH LOW USEC PSEC)
-in the same style as (current-time).
+The value when Emacs is idle is a Lisp timestamp in the style of
+`current-time'.
The value when Emacs is not idle is nil.
majflt -- number of major page faults (number)
cminflt -- cumulative number of minor page faults (number)
cmajflt -- cumulative number of major page faults (number)
- utime -- user time used by the process, in (current-time) format,
- which is a list of integers (HIGH LOW USEC PSEC)
+ utime -- user time used by the process, in `current-time' format
stime -- system time used by the process (current-time)
time -- sum of utime and stime (current-time)
cutime -- user time used by the process and its children (current-time)
start -- time the process started (current-time)
vsize -- virtual memory size of the process in KB's (number)
rss -- resident set size of the process in KB's (number)
- etime -- elapsed time the process is running, in (HIGH LOW USEC PSEC) format
+ etime -- elapsed time the process is running (current-time)
pcpu -- percents of CPU time used by the process (floating-point number)
pmem -- percents of total physical memory used by process's resident set
(floating-point number)