summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-09-23 18:30:46 -0700
committerKyle Meyer <kyle@kyleam.com>2019-01-13 12:43:04 -0500
commitd64c9a996b1941672546a7b78473ce6ffaaf842d (patch)
tree4ad07c153ef46fa9febd3c031b0995b4ce45bb58
parent9a8462771f2e140c63e0acdf498bd0c36e70488a (diff)
downloadorg-mode-d64c9a996b1941672546a7b78473ce6ffaaf842d.tar.gz
Backport commit 662bee7d7 from Emacs
* lisp/ob-eval.el (org-babel--shell-command-on-region): * lisp/org-attach.el (org-attach-commit): * lisp/org-macro.el (org-macro-initialize-templates): * lisp/org.el (org-babel-load-file) (org-file-newer-than-p): * lisp/ox-html.el (org-html-format-spec): * lisp/ox-publish.el (org-publish-find-date) (org-publish-cache-ctime-of-src): Prefer (file-attribute-size A) to (nth 7 A), and similarly for other file attributes accessors. * lisp/ox-publish.el (org-publish-cache-ctime-of-src): Prefer float-time to doing time arithmetic by hand. file-attributes cleanup 662bee7d70ccd3903e123b08c7ec9108a1a2ce0b Paul Eggert Sun Sep 23 18:32:59 2018 -0700
-rw-r--r--lisp/ob-eval.el2
-rw-r--r--lisp/org-attach.el2
-rw-r--r--lisp/org-macro.el3
-rw-r--r--lisp/org.el5
-rw-r--r--lisp/ox-html.el3
-rw-r--r--lisp/ox-publish.el9
6 files changed, 14 insertions, 10 deletions
diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el
index 0587851..8d5b7ed 100644
--- a/lisp/ob-eval.el
+++ b/lisp/ob-eval.el
@@ -120,7 +120,7 @@ function in various versions of Emacs.
(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)
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index df06292..15ce65e 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -354,7 +354,7 @@ This checks for the existence of a \".git\" directory in that directory."
(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))
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 164a415..c14703c 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -158,7 +158,8 @@ a file, \"input-file\" and \"modification-time\"."
'%s)))"
(prin1-to-string visited-file)
(prin1-to-string
- (nth 5 (file-attributes visited-file))))))))
+ (file-attribute-modification-time
+ (file-attributes visited-file))))))))
;; Install built-in macros.
(list
'("n" . "(eval (org-macro--counter-increment $1 $2))")
diff --git a/lisp/org.el b/lisp/org.el
index 450659e..354f437 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -253,8 +253,9 @@ file to byte-code before it is loaded."
(let* ((age (lambda (file)
(float-time
(time-subtract nil
- (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
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index ed8bb74..bea03e4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1953,7 +1953,8 @@ INFO is a plist used as a communication channel."
(?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)
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index 9da7d3a..d9fc8d2 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -881,7 +881,8 @@ time in `current-time' format."
(or (org-publish-cache-get-file-property file :date nil t)
(org-publish-cache-set-file-property
file :date
- (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.
@@ -891,7 +892,8 @@ time in `current-time' format."
(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)
@@ -1364,8 +1366,7 @@ does not exist."
(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)