org-compat: Define file-attribute accessors

* lisp/org-compat.el (file-attribute-modification-time,
file-attribute-size): New functions for compatibility with Emacsen
before 26.1.

This is a follow-up to the backport of Emacs's 662bee7d7.
This commit is contained in:
Kyle Meyer 2018-12-28 17:16:54 -05:00
parent d64c9a996b
commit 6c4acc8ded
1 changed files with 14 additions and 0 deletions

View File

@ -81,6 +81,20 @@
(defalias 'org-line-number-display-width 'line-number-display-width)
(defun org-line-number-display-width (&rest _) 0))
(unless (fboundp 'file-attribute-modification-time)
(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)."
(nth 5 attributes)))
(unless (fboundp 'file-attribute-size)
(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."
(nth 7 attributes)))
;;; Emacs < 25.1 compatibility