|
@@ -312,17 +312,23 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
|
|
;;; File
|
|
;;; File
|
|
|
|
|
|
(defun org-file-newer-than-p (file time)
|
|
(defun org-file-newer-than-p (file time)
|
|
- "Non-nil if FILE is newer than TIME.
|
|
|
|
-FILE is a filename, as a string, TIME is a Lisp time value, as
|
|
|
|
-returned by, e.g., `current-time'."
|
|
|
|
- (and (file-exists-p file)
|
|
|
|
- ;; Only compare times up to whole seconds as some file-systems
|
|
|
|
- ;; (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 (org-time-convert-to-integer
|
|
|
|
- (nth 5 (file-attributes file)))
|
|
|
|
- (org-time-convert-to-integer time)))))
|
|
|
|
|
|
+ "Non-nil if FILE modification time is greater than TIME.
|
|
|
|
+TIME should be obtained earlier for the same FILE name using
|
|
|
|
+
|
|
|
|
+ \(file-attribute-modification-time (file-attributes file))
|
|
|
|
+
|
|
|
|
+If TIME is nil (file did not exist) then any existing FILE
|
|
|
|
+is considered as a newer one. Some file systems have coarse
|
|
|
|
+timestamp resolution, for example 1 second on HFS+ or 2 seconds on FAT,
|
|
|
|
+so nil may be returned when file is updated twice within a short period
|
|
|
|
+of time. File timestamp and system clock `current-time' may have
|
|
|
|
+different resolution, so attempts to compare them may give unexpected
|
|
|
|
+results.
|
|
|
|
+
|
|
|
|
+Consider `file-newer-than-file-p' to check up to date state
|
|
|
|
+in target-prerequisite files relation."
|
|
|
|
+ (let ((mtime (file-attribute-modification-time (file-attributes file))))
|
|
|
|
+ (and mtime (or (not time) (time-less-p time mtime)))))
|
|
|
|
|
|
(defun org-compile-file (source process ext &optional err-msg log-buf spec)
|
|
(defun org-compile-file (source process ext &optional err-msg log-buf spec)
|
|
"Compile a SOURCE file using PROCESS.
|
|
"Compile a SOURCE file using PROCESS.
|
|
@@ -356,7 +362,7 @@ it for output."
|
|
(full-name (file-truename source))
|
|
(full-name (file-truename source))
|
|
(out-dir (or (file-name-directory source) "./"))
|
|
(out-dir (or (file-name-directory source) "./"))
|
|
(output (expand-file-name (concat base-name "." ext) out-dir))
|
|
(output (expand-file-name (concat base-name "." ext) out-dir))
|
|
- (time (current-time))
|
|
|
|
|
|
+ (time (file-attribute-modification-time (file-attributes output)))
|
|
(err-msg (if (stringp err-msg) (concat ". " err-msg) "")))
|
|
(err-msg (if (stringp err-msg) (concat ". " err-msg) "")))
|
|
(save-window-excursion
|
|
(save-window-excursion
|
|
(pcase process
|
|
(pcase process
|