summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2018-12-28 17:16:54 -0500
committerKyle Meyer <kyle@kyleam.com>2019-01-13 12:43:04 -0500
commit6c4acc8deddb3edad70ab8e902683e429e2ee584 (patch)
tree0692f2442d805605bebd7af071a003f0fea48332
parentd64c9a996b1941672546a7b78473ce6ffaaf842d (diff)
downloadorg-mode-6c4acc8deddb3edad70ab8e902683e429e2ee584.tar.gz
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.
-rw-r--r--lisp/org-compat.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 3c9321c..9b7638d 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -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