emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/org-contrib 9dc8f49: Don’t assume Emacs internal timestam


From: Paul Eggert
Subject: [nongnu] elpa/org-contrib 9dc8f49: Don’t assume Emacs internal timestamp format
Date: Wed, 15 Dec 2021 12:22:54 -0500 (EST)

branch: elpa/org-contrib
commit 9dc8f4914888b904a7edceae6deda5329777ae94
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Don’t assume Emacs internal timestamp format
    
    This format is documented to change in some future Emacs version.
    * lisp/ox-groff.el (org-groff--time-sec): New function.
    (org-groff-compile): Use it.
---
 lisp/ox-groff.el | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-groff.el b/lisp/ox-groff.el
index 5c18085..3e376f1 100644
--- a/lisp/ox-groff.el
+++ b/lisp/ox-groff.el
@@ -647,16 +647,16 @@ See `org-groff-text-markup-alist' for details."
 
 
     ;; If FROM then get data from FROM
-    (if from-data 
+    (if from-data
         (setq from-data
               (replace-regexp-in-string "\\.P\n" "" from-data))
       (setq from-data ""))
-    
-    (if to-data 
+
+    (if to-data
         (setq to-data
               (replace-regexp-in-string "\\.P\n" "" to-data))
       (setq from-data ""))
-    
+
     (concat
      (cond
       (from-data
@@ -1879,6 +1879,12 @@ Return PDF file's name."
       async subtreep visible-only body-only ext-plist
       (lambda (file) (org-groff-compile file)))))
 
+;; Port to Emacs 26 and earlier.
+(defun org-groff--time-sec (time)
+  (if (fboundp 'time-convert)
+      (time-convert time 'integer)
+    (cl-subseq (or time (current-time)) 0 2)))
+
 (defun org-groff-compile (file)
   "Compile a Groff file.
 
@@ -1889,7 +1895,7 @@ Return PDF file name or an error if it couldn't be 
produced."
   (let* ((base-name (file-name-sans-extension (file-name-nondirectory file)))
         (full-name (file-truename file))
         (out-dir (file-name-directory file))
-        (time (current-time))
+        (time (org-groff--time-sec nil))
         ;; Properly set working directory for compilation.
         (default-directory (if (file-name-absolute-p file)
                                (file-name-directory full-name)
@@ -1928,8 +1934,9 @@ Return PDF file name or an error if it couldn't be 
produced."
                ;; Only compare times up to whole seconds as some
                ;; filesystems (e.g. HFS+) do not retain any finer
                ;; granularity.
-               (time-less-p (cl-subseq (nth 5 (file-attributes pdffile)) 0 2)
-                            (cl-subseq time 0 2)))
+               (time-less-p (org-groff--time-sec
+                             (nth 5 (file-attributes pdffile)))
+                            time))
            (error (concat (format "PDF file %s wasn't produced" pdffile)
                           (when errors (concat ": " errors))))
          ;; Else remove log files, when specified, and signal end of



reply via email to

[Prev in Thread] Current Thread [Next in Thread]